ra-core
Version:
Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React
16 lines • 643 B
JavaScript
import { useContext } from 'react';
import { SimpleFormIteratorContext } from "./SimpleFormIteratorContext.js";
/**
* A hook 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 var useSimpleFormIterator = function () {
var context = useContext(SimpleFormIteratorContext);
if (!context) {
throw new Error('useSimpleFormIterator must be used inside a SimpleFormIterator');
}
return context;
};
//# sourceMappingURL=useSimpleFormIterator.js.map