Skip to content

Instantly share code, notes, and snippets.

@davidgilbertson
Created April 18, 2021 00:59
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 davidgilbertson/4199e3c824aa8bbd611eebe92fffa160 to your computer and use it in GitHub Desktop.
Save davidgilbertson/4199e3c824aa8bbd611eebe92fffa160 to your computer and use it in GitHub Desktop.
const List = <ItemType extends {id: string}>(props: {
items: ItemType[];
renderItem: (item: ItemType) => React.ReactNode;
}) => (
<ul>
{props.items.map(item => (
<li key={item.id}>{props.renderItem(item)}</li>
))}
</ul>
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment