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 775 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useEditContext = void 0; const react_1 = require("react"); const EditContext_1 = require("./EditContext.cjs"); /** * Hook to read the edit controller props from the EditContext. * * Used within a <EditContextProvider> (e.g. as a descendent of <Edit>). * * @returns {EditControllerResult} edit controller props * * @see useEditController for how it is filled */ const useEditContext = () => { const context = (0, react_1.useContext)(EditContext_1.EditContext); if (!context) { throw new Error('useEditContext must be used inside an EditContextProvider'); } return context; }; exports.useEditContext = useEditContext; //# sourceMappingURL=useEditContext.js.map