I’ve done this project twice and did my best to copy the solution video and it still doesnt work.
Heres my code for each part:
App.js:
import React from 'react';
import {comments} from './commentData';
import Card from './Card';
function App () {
return (
comments.map(comment =>
<Card commmentObject = {comment} />
)
);
}
export default App;
Card.js:
import React from 'react';
import Body from './Body';
import Header from './Header';
function Card (props) {
return (
<div>
<Header profileImg={props.commentObject.profileImg} username={props.commentObject.username}/>
<Body comment={props.commentObject.comment}/>
</div>
)
}
export default Card;
Header.js:
import React from 'react';
function Header (props) {
return (
<div>
<img
src = {props.profileImg}
/>
<h1>{props.username}</h1>
</div>
)
}
export default Header;
Body.js:
import React from 'react';
function Body (props) {
return (
<>
<p>{props.comment}</P>
</>
);
}
export default Body;
index.js:
import React from 'react';
import {createRoot} from 'react-dom/client';
import App from './App';
createRoot(
document.getElementById('app')
).render(<App/>);
Thanks for any help!!