-
Notifications
You must be signed in to change notification settings - Fork 6.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Completed Component Props Mini Project #33
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work! Just make sure you take a minute once you're done coding to go back and clean up.
package-lock.json
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eeek yes for sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
src/components/About.js
Outdated
import React from "react" | ||
// import blogData from "../data/blog" | ||
|
||
|
||
function About({image='https://via.placeholder.com/215', about | ||
}) { | ||
|
||
return ( | ||
<> | ||
<aside> | ||
<img src={image} alt='blog logo'></img> | ||
<p>{about}</p> | ||
</aside> | ||
</> | ||
) | ||
} | ||
|
||
export default About |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import React from "react" | |
// import blogData from "../data/blog" | |
function About({image='https://via.placeholder.com/215', about | |
}) { | |
return ( | |
<> | |
<aside> | |
<img src={image} alt='blog logo'></img> | |
<p>{about}</p> | |
</aside> | |
</> | |
) | |
} | |
export default About | |
import React from "react" | |
function About({ image='https://via.placeholder.com/215', about }) { | |
return ( | |
<aside> | |
<img src={image} alt='blog logo'></img> | |
<p>{about}</p> | |
</aside> | |
) | |
} | |
export default About |
src/components/Article.js
Outdated
import React from "react" | ||
|
||
|
||
|
||
function Article({title, date ='January 1, 1970', preview}) { | ||
return ( | ||
<> | ||
<article> | ||
<h3>{title}</h3> | ||
<small>{date}</small> | ||
<p>{preview}</p> | ||
</article> | ||
</> | ||
) | ||
} | ||
|
||
|
||
|
||
export default Article |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When are fragments needed? Do you need one here?
import React from "react" | |
function Article({title, date ='January 1, 1970', preview}) { | |
return ( | |
<> | |
<article> | |
<h3>{title}</h3> | |
<small>{date}</small> | |
<p>{preview}</p> | |
</article> | |
</> | |
) | |
} | |
export default Article | |
import React from "react" | |
function Article({ title, date ='January 1, 1970', preview }) { | |
return ( | |
<article> | |
<h3>{title}</h3> | |
<small>{date}</small> | |
<p>{preview}</p> | |
</article> | |
) | |
} | |
export default Article |
src/components/ArticleList.js
Outdated
import React from "react" | ||
import Article from "./Article"; | ||
|
||
function ArticleList({posts}) { | ||
|
||
return ( | ||
<> | ||
<main> | ||
{posts.map((post) => { | ||
return ( | ||
<Article | ||
key={post.id} | ||
title={post.title} | ||
date={post.date} | ||
preview={post.preview} | ||
/> | ||
) | ||
})} | ||
</main> | ||
</> | ||
) | ||
} | ||
|
||
export default ArticleList |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import React from "react" | |
import Article from "./Article"; | |
function ArticleList({posts}) { | |
return ( | |
<> | |
<main> | |
{posts.map((post) => { | |
return ( | |
<Article | |
key={post.id} | |
title={post.title} | |
date={post.date} | |
preview={post.preview} | |
/> | |
) | |
})} | |
</main> | |
</> | |
) | |
} | |
export default ArticleList | |
import React from "react" | |
import Article from "./Article"; | |
function ArticleList({ posts }) { | |
return ( | |
<main> | |
{posts.map((post) => { | |
return ( | |
<Article | |
key={post.id} | |
title={post.title} | |
date={post.date} | |
preview={post.preview} | |
/> | |
) | |
})} | |
</main> | |
) | |
} | |
export default ArticleList |
src/components/Header.js
Outdated
import React from "react" | ||
// import blogData from "../data/blog" | ||
|
||
|
||
function Header({name}) { | ||
return ( | ||
<header> | ||
<h1>{name}</h1> | ||
</header> | ||
) | ||
} | ||
|
||
|
||
|
||
export default Header |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import React from "react" | |
// import blogData from "../data/blog" | |
function Header({name}) { | |
return ( | |
<header> | |
<h1>{name}</h1> | |
</header> | |
) | |
} | |
export default Header | |
import React from "react" | |
function Header({name}) { | |
return ( | |
<header> | |
<h1>{name}</h1> | |
</header> | |
) | |
} | |
export default Header |
Built a static blog site in React using components, JSX, and passed down data as props.