Skip to content

Instantly share code, notes, and snippets.

@dgtlmonk
Created July 19, 2020 06:25
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 dgtlmonk/f4b5b759b545c6bad88731a13ae9a088 to your computer and use it in GitHub Desktop.
Save dgtlmonk/f4b5b759b545c6bad88731a13ae9a088 to your computer and use it in GitHub Desktop.
interface Props<T> {
items: T[];
renderItem: (item: T) => React.ReactNode;
}
function List<T>(props: Props<T>) {
const { items, renderItem } = props;
const [state, setState] = React.useState<T[]>([]);
return (
<div>
{items.map(renderItem)}
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment