UNPKG

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 (16 loc) 437 B
import { useCallback } from 'react'; import { useRecordSelection } from './useRecordSelection'; /** * Hook to unselect all row of a datagrid * * @example * * const unselectAll = useUnselectAll('posts'); * unselectAll(); */ export const useUnselectAll = (resource: string) => { const [, { clearSelection }] = useRecordSelection(resource); return useCallback(() => { clearSelection(); }, [clearSelection]); };