-
-
Save codecademydev/ac077863c3f9072c908e19d3e6b5a9b4 to your computer and use it in GitHub Desktop.
Codecademy export
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {comments} from './commentData' | |
import { Card } from './Card'; | |
export default function App() { | |
return ( | |
<div> | |
{comments.map(comment => <Card commentObject={comment} />)} | |
</div> | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export default function Body(props) { | |
return ( | |
<p> | |
{props.comment} | |
</p> | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { Header } from './Header'; | |
import { Body } from './Body'; | |
export default function Card(props) { | |
return ( | |
<div> | |
<Header profileImg={props.commentObject.profileImg} username={props.commentObject.username} /> | |
<Body comment={props.commentObject.comment} /> | |
</div> | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const comments = [ | |
{ | |
profileImg: 'https://images.unsplash.com/photo-1609992556706-14a7056ea745?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1287&q=80', | |
username: 'ScrungeCat', | |
comment: 'My favorite types of cats are slightly weird looking ones!' | |
}, | |
{ | |
profileImg: 'https://images.unsplash.com/photo-1615751072497-5f5169febe17?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1335&q=80', | |
username: 'ChewToy', | |
comment: 'I don\'t like cats at all.' | |
}, | |
{ | |
profileImg: 'https://images.unsplash.com/photo-1563482776068-4dac10f9373d?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80', | |
username: 'BuryHeadInSand', | |
comment: 'Wild ostriches make the best pets.' | |
} | |
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
export default function Header(props) { | |
return ( | |
<div> | |
<img src={props.profileImg} /> | |
<h1>{props.username}</h1> | |
</div> | |
) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<link rel="stylesheet" href="style.css"> | |
</head> | |
<body> | |
<main id="app"> | |
</main> | |
<script src="https://content.codecademy.com/courses/React/react-18-course-bundle.min.js"></script> | |
<script src="/index.compiled.js"></script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom/client'; | |
import { App } from './App'; | |
const root = ReactDOM.createRoot(document.getElementById('app')); | |
root.render(<App />); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment