ra-core
Version:
Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React
19 lines • 594 B
JavaScript
import { useCallback } from 'react';
import { useRecordSelection } from "./useRecordSelection.js";
/**
* Hook to Unselect the rows of a datagrid
*
* @example
*
* const unselect = useUnselect('posts');
* unselect([123, 456]);
*/
export const useUnselect = (resource, storeKey) => {
const [, { unselect }] = useRecordSelection(resource
? { resource, storeKey }
: { disableSyncWithStore: true, storeKey });
return useCallback((ids, fromAllStoreKeys = false) => {
unselect(ids, fromAllStoreKeys);
}, [unselect]);
};
//# sourceMappingURL=useUnselect.js.map