import { ReactNode } from "react";
interface ListProps {
items: string[];
render: (item: string) => ReactNode;
}
// the caller controls how each item renders
function List({ items, render }: ListProps) {
return <ul>{items.map(render)}</ul>;
}
export default List;a prop that is a function returning JSX