I'm trying to modularize my components into external files and import them into an index file, but I'm running into an error related to passing an array to an imported component. It doesn't appear to be handling this array in my modularized component and I'm wondering if it is an issue with my importation in my index file or with my component logic in the external file. Can anyone point me in the right direction?
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>
)
}
record-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 />
);
}
}
RecordCardRecordCard. Why you are usingCommentandComments. Both are same