UNPKG

ra-core

Version:

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

18 lines (14 loc) 458 B
import { useContext } from 'react'; import { PreferencesEditorContext, PreferencesEditorContextValue, } from './PreferencesEditorContext'; export const usePreferencesEditor = (): PreferencesEditorContextValue => { const context = useContext(PreferencesEditorContext); if (!context) { throw new Error( 'usePreferencesEditor must be used within a PreferencesEditorContextProvider' ); } return context; };