UNPKG

@twilio-paste/paste-reakit-fork

Version:

Forked Reakit that addresses SSR hydration issues

17 lines (14 loc) 377 B
import { Item } from "./types"; const nullItem = { id: null, ref: { current: null } }; export function placeItemsAfter( items: Item[], id: string, shouldInsertNullItem?: boolean ) { const index = items.findIndex((item) => item.id === id); return [ ...items.slice(index + 1), ...(shouldInsertNullItem ? [nullItem] : []), ...items.slice(0, index), ]; }