UNPKG

ra-core

Version:

Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React

21 lines (18 loc) 639 B
import { createContext } from 'react'; /** * A React context that provides access to a SimpleFormIterator data (the total number of items) and mutators (add, reorder and remove). * Useful to create custom array input iterators. * @see {SimpleFormIterator} * @see {ArrayInput} */ export const SimpleFormIteratorContext = createContext< SimpleFormIteratorContextValue | undefined >(undefined); export type SimpleFormIteratorContextValue = { add: (item?: any) => void; clear: () => void; remove: (index: number) => void; reOrder: (index: number, newIndex: number) => void; source: string; total: number; };