codestates / codestates/aneun-dongne
[Dev-Log] 1205 / 류준열
- Dominant language
- JavaScript
- Stars
- 6
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
> ### 오늘은 어떻게 프로젝트에 기여했나요?
> 관광지세부페이지 댓글,해시태그 수정 및 작성 기능
> ### 오늘의 프로젝트에서 힘든 점은 무엇인가요?
> * 항목별로 적어주세요.
> 댓글 작성할때 '엔터'키로 작성하면 '\n'도 댓글로 인식되어 빈칸댓글도 추가되었다.

useEffect로 setState를 sideEffect로부터 보호해야 하는줄 알았으나 , 나중에 알고보니 `props`전달에서 생긴 문제였다. props전달시 ` if(props.value==='\n') return ; ` 해주니 해결되었다.
하위 컴퍼넌트에 `props`로 `\n`이 고스란히 전달되어 렌더링된다는 것을 인지하지 못해서 경험한 버그였다.
아래와 같이 주석부분을 추가하니 해결되었다.
```js
function CommentTemplate({ commentDummy }) {
console.log(commentDummy);
return (
<>
{commentDummy.map((comment, idx) => {
// 추가한부분
if (comment.text === "\n") return null;
//
return (
);
})}
);
}
```
> ### 내일은 프로젝트에 기여하기 위해 무엇을 해야 하나요?
> * [ ] 홈화면 뒤엎기
> * [ ] 서버랑 이야기하기
Contributor guide
No contributing guide indexed for this repository
Research direction
This issue is a development log documenting an already-resolved frontend comment bug involving CommentTemplate and newline props. Review the provided CommentTemplate snippet and the described props behavior; no remaining change, test, or definition of done is specified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Documentation
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100