UNPKG

ra-core

Version:

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

23 lines 769 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useUnselect = void 0; const react_1 = require("react"); const useRecordSelection_1 = require("./useRecordSelection.cjs"); /** * Hook to Unselect the rows of a datagrid * * @example * * const unselect = useUnselect('posts'); * unselect([123, 456]); */ const useUnselect = (resource, storeKey) => { const [, { unselect }] = (0, useRecordSelection_1.useRecordSelection)(resource ? { resource, storeKey } : { disableSyncWithStore: true, storeKey }); return (0, react_1.useCallback)((ids, fromAllStoreKeys = false) => { unselect(ids, fromAllStoreKeys); }, [unselect]); }; exports.useUnselect = useUnselect; //# sourceMappingURL=useUnselect.js.map