20CAKE20.JS
06-components

Components

23

06-components/ListBox.tsx

List Box

Support

Support source used by the official components examples.

export type Props<Item> = {
  items: Item[];
  keyOf: (item: Item) => string | number;
  item: (item: Item, index: number) => View;
};

export default <Item,>(props: Props<Item>) => (
  <ul>
    {props.items.map((value, index) => (
      <li key={props.keyOf(value)}>{props.item(value, index)}</li>
    ))}
  </ul>
);