inflearn logo
강의

講義

知識共有

フォローして学習するノード、リアクトシリーズ - YouTubeサイトを作成

コメント機能の生成 (4) ReplyComment

또.. 질문입니다 ㅎㅎㅎㅎ...

249

patmos34336131

投稿した質問数 19

0

질문이 많아서 죄송하네요 ㅠ.ㅠ

코멘트를 랜더하는 코드에서 

중괄호를 써서 함수를 만들면 (두번째 코드)

랜더가 안되더라구요

중괄호가 들어가는 것과 들어가지 않은것이 무슨 차이가 있는지 궁금합니다 

궁금한게 많은것 같아서 죄송하네요 ㅠ.ㅠ.

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

react mongodb redux nodejs

回答 2

1

John Ahn

안녕하세요 릴롱궤님  ㅎㅎㅎ 
친구가 된것 같네요 ㅎ 

중괄호를 하면 return 으로   표현해줄부분을 출력해주셔야   화면에 보이게 되고 

아니면  지금처럼 아예 중괄호를 없애 주시거나   ()   이걸로 감싸주셔도 됩니다 ^^ 

0

patmos34336131

감사합니다!

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

0

52

1

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

0

221

1

자료 없음

0

322

1

이미지 깨짐

0

336

1

npm run dev 동작 에러

0

304

1

npm run dev 동작 에러

0

295

1

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

0

661

1

npm run dev 실행 오류

0

653

1

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

0

1057

1

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

1

467

1

오류 해결 공유

0

459

1

npm install 에러 질문드립니다.

0

1121

2

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

0

550

1

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

0

516

1

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

0

515

0

video가 안 나타나는 문제

0

894

1

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

0

471

0

typeError or 콘솔 500 뜨는분..

0

336

0

npm run dev 관련 오류

0

578

1

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

0

246

0

useState 자동 생성

0

347

1

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

0

1246

2

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

0

248

0

antd Input background color 변경

0

242

0