Skip to content

Instantly share code, notes, and snippets.

@caelinsutch
Created February 1, 2021 23:30
Show Gist options
  • Save caelinsutch/5efd09bfdf8120a0c2a3329d8c4d9ffc to your computer and use it in GitHub Desktop.
Save caelinsutch/5efd09bfdf8120a0c2a3329d8c4d9ffc to your computer and use it in GitHub Desktop.
Lists
// Don't write lops with the rest of the code
const Component = ({title, cards}) => {
return <div>
<h1>{title}</h1>
{
cards.map(({title: cardTitle, subtitle, image}) => ({
<div>
<h3>{cardTitle}</h3>
<h5>{subtitle}</h5>
<img src={image} />
</div>
}))
}
</div>
}
// Break it up into a separate list component
const Component = ({title, cards}) => {
return <div>
<h1>{title}</h1>
<CardsList cards={cards} />
</div>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment