dynamicTable.ts 298 B

12345678910
  1. import { DynamicTableItemProps } from '../components/DynamicTable';
  2. export const prepareItems = <T = unknown>(
  3. items: T[],
  4. idCreator?: (item: T) => number | string
  5. ): Array<DynamicTableItemProps<T>> =>
  6. items.map((item, index) => ({
  7. id: idCreator?.(item) ?? index,
  8. data: item,
  9. }));