내 구성 요소를 외부 파일로 모듈화하고 인덱스 파일로 가져 오려고하지만 가져온 구성 요소에 배열을 전달하는 것과 관련된 오류가 발생합니다. 내 모듈화 된 구성 요소에서이 배열을 처리하는 것으로 나타나지 않고 내 인덱스 파일이나 외부 파일의 구성 요소 논리에서 가져온 항목에 문제가 있는지 궁금합니다. 누구든지 올바른 방향으로 나를 가리킬 수 있습니까?ReactJS - 가져온 구성 요소에 배열 전달
하는 index.js :
import React from 'react';
import fetch from 'node-fetch';
import ReactMarkdown from 'react-markdown';
import path from 'path';
import Comments from './comment/record-comment';
//Loop through JSON and create Record and Comment Container Component
const RecordFeed = props => {
return (
<div>
{
props.records.map((record, index) => {
return (
<RecordCard {...record} key={record.recordIdHash} user={props.user}>
{ record.record_comments.map((comment, i) =>
<Comments {...comment} key={comment.recordCommentId} />
)}
</RecordCard>
);
})
}
</div>
)
}
기록 comment.js :
import React from 'react';
//Record Comment - Comment
const Comment = props => {
return (
<div>
<h5>{props.user_id}</h5>
<h4>{props.comment}</h4>
<h3>{props.app_user.fullNameSlug}</h3>
</div>
)
}
//Record Comment - Container
export default class Comments extends React.Component {
render() {
return (
<Comment />
);
}
}
오류가 기록되고 있습니까? – topher
'RecordCard'를 가져올 수 없습니다. –
'RecordCard'를 가져 오십시오. 왜 당신이'Comment'와'Comments'를 사용하는지. 모두 동일합니다 – PranavPinarayi