1. FeedData.json 파일 ( mock data를 담을 json파일 )
feed.js 파일 필요
FeedData.json -> 배열형태로 고유한 id값과 변경하고싶은 값 지정하고
[
{
"id":1,
"userId": "username"
}
[
변경하고 싶은 데이터의 위치를 지정해 ( ex. userid ) 태그안에 지정해준다.
<span>{feedInfo.userID}</span>
feedList.map ( list => {
return (
<FeedData
key={list.id} />
2. 변경하고 싶은 html 태그를 js파일내 return 하단에 붙여준다.
붙여넣기 하면 분명 에러가 생길것!
<div className="feedCotainer">
{feedList.map(list => {
return (
<FeedData
key={list.id}
feedInfo={list}
commentList={commentList}
commentArray={commentArray}
onSubmitComment={onSubmitComment}
comment={comment}
handleReviewInput={handleReviewInput}
/>
);
})}
</div>
내가 만든 컴포넌트들에서 에러가 발생할것이다.
부모요소에 추가했던 요소들을 자식파일로 불러와준다.
function FeedData({
feedInfo,
commentList,
commentArray,
onSubmitComment,
comment,
handleReviewInput,
})