Skip to content

Instantly share code, notes, and snippets.

@davidgilbertson
Created April 18, 2021 00:57
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/c49b0aa851107273d72f3957573f8aea to your computer and use it in GitHub Desktop.
Save davidgilbertson/c49b0aa851107273d72f3957573f8aea to your computer and use it in GitHub Desktop.
const List = <ItemType extends any>(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