removeAtArrayIndex.tsx 223 B

12345678
  1. /**
  2. * Remove item at `index` in `array` without mutating `array`
  3. */
  4. export function removeAtArrayIndex<T>(array: T[], index: number): T[] {
  5. const newArray = [...array];
  6. newArray.splice(index, 1);
  7. return newArray;
  8. }