Created
July 24, 2020 21:47
-
-
Save nsantos16/c097d8e791ad91ff45b0f835f5ab0219 to your computer and use it in GitHub Desktop.
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, { Fragment } from 'react'; | |
const ListItem = ({ item }) => ( | |
<Fragment> | |
<span>{item}</span> | |
</Fragment> | |
); | |
// Try to avoid index as key's | |
const List = ({ items = [] }) => ( | |
<div className="list-component"> | |
<ListTitle title="List component" /> | |
<div className="list-component-items"> | |
{items.map((item, index) => ( | |
<ListItem item={item} key={index} /> | |
))} | |
</div> | |
</div> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment