Skip to content

Instantly share code, notes, and snippets.

@nsantos16
Created July 24, 2020 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nsantos16/c097d8e791ad91ff45b0f835f5ab0219 to your computer and use it in GitHub Desktop.
Save nsantos16/c097d8e791ad91ff45b0f835f5ab0219 to your computer and use it in GitHub Desktop.
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