Skip to content

Instantly share code, notes, and snippets.

@sbussard
Last active June 1, 2018 22:49
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 sbussard/81c509b149ef7023f65651d95755842d to your computer and use it in GitHub Desktop.
Save sbussard/81c509b149ef7023f65651d95755842d to your computer and use it in GitHub Desktop.
let itemData = [
{ name: 'Chair', price: '$199', id: 'abc123' },
{ name: 'Table', price: '$799', id: 'def456' }
];
let Item = ({ description, id }) => <li key={id}>{description}</li>;
let makeProps = ({ name, price, id }) => ({
id,
description: `${name} - ${price}`
});
let ItemList = ({ items }) => <ul>{items.map(makeProps).map(Item)}</ul>;
// ... <ItemList items={itemData} />
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment