inflearn logo
강의

Course

Instructor

Node and React series that you can learn by following - Creating a YouTube site

Create a comment function (4) ReplyComment

도와주세요!!ㅠㅠ

288

newCode

10 asked

0

안녕하세요~

강사님 깃헙도 참고하고 다른분들 깃헙도 참고하면서 오류를 찾아 2번째 뎁스에 있는 코멘트가 왜 안보여지나 찾아내려고 했는데,  여러번 처음부터 다시해보고도 했는데, 계속 똑같은 오류로 해결하지 못했어요...

도와주시면 정말 감사하겠습니다!

(이미지는 똑같은 오류라 같은것으로 올립니다)

https://github.com/lhj1004ss/youtube_clone

한번 

https://github.com/lhj1004ss/youtube_clone

mongodb nodejs redux react

Answer 2

3

John Ahn

앗 ㅠㅠ    

const renderReplyComment = (parentCommentId) => {

이부분에  {  } 이걸로 하면 return 넣어 주셔야 하고 아니면 {} 이거를 빼주셔야 렌더링 됩니다 ㅠㅠ 

const renderReplyComment = (parentCommentId) => {
return props.commentList.map((comment, index) => (
<React.Fragment>
{comment.responseTo === parentCommentId && (
<div style={{ width: "80%", marginLeft: "30px" }}>
<SingleComment
key={index}
refreshFunction={props.refreshFunction}
comment={comment}
postId={props.videoId}
/>
<ReplyComment
commentList={props.commentList}
postId={props.videoId}
parentCommentId={comment._id}
refreshFunction={props.refreshFunction}
/>
</div>
)}
</React.Fragment>
));
}

이거나 

const renderReplyComment = (parentCommentId) =>
props.commentList.map((comment, index) => (
<React.Fragment>
{comment.responseTo === parentCommentId && (
<div style={{ width: "80%", marginLeft: "30px" }}>
<SingleComment
key={index}
refreshFunction={props.refreshFunction}
comment={comment}
postId={props.videoId}
/>
<ReplyComment
commentList={props.commentList}
postId={props.videoId}
parentCommentId={comment._id}
refreshFunction={props.refreshFunction}
/>
</div>
)}
</React.Fragment>
));

이런식으로 해주세요 ㅠㅠ  

이런 세세한게 발견하기 어려운거같아요 수고하셨습니다 ^^;;!

0

newCode

정말 감사합니다! 얼른 마무리하고 쇼핑몰로 넘어가도록 하겠습니다!

npm i하면 바로, 라이브러리 오류없이 받아지고, 구동되는 소스는 없나요?

0

52

1

ERROR in ./node_modules/antd/es/version/index.js 2:15-22

0

221

1

자료 없음

0

321

1

이미지 깨짐

0

334

1

npm run dev 동작 에러

0

304

1

npm run dev 동작 에러

0

294

1

npm run dev 동작에러납니다...

0

660

1

npm run dev 실행 오류

0

653

1

비디오 업로드, 로그인, 회원가입 504 error

0

1056

1

시작부터 오류생기시는 분들 해결법입니다.

1

466

1

오류 해결 공유

0

458

1

npm install 에러 질문드립니다.

0

1120

2

아예 몽고DB에 연결한다고만 하고 연결이 안되고 있습니다.

0

550

1

해당 오류 해결 방법 좀 알려주세요 ㅠㅠ

0

515

1

로컬스토리지에 대한 질문입니다!!

0

515

0

video가 안 나타나는 문제

0

893

1

ffmpeg 설치 후 cannot read property 'format' of undefined 500 에러 해결

0

470

0

typeError or 콘솔 500 뜨는분..

0

336

0

npm run dev 관련 오류

0

578

1

답글이 달리지않고 디비에도 저장되지않으며 새로고침이 됩니다.

0

246

0

useState 자동 생성

0

345

1

TypeError: Cannot read properties of undefined (reading 'format')

0

1246

2

userData undefined / state에 user.userData가 없습니다.

0

246

0

antd Input background color 변경

0

238

0