UNPKG

ra-core

Version:

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

24 lines 939 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.useSetInspectorTitle = void 0; const react_1 = require("react"); const usePreferencesEditor_1 = require("./usePreferencesEditor.cjs"); /** * Set inspector title on mount * * @example * useSetInspectorTitle('Datagrid'); */ const useSetInspectorTitle = (title, options) => { const preferencesEditorContext = (0, usePreferencesEditor_1.usePreferencesEditor)(); if (!preferencesEditorContext) { throw new Error('useSetInspectorTitle cannot be called outside of a PreferencesEditorContext'); } const { setTitle } = preferencesEditorContext; (0, react_1.useEffect)(() => { setTitle(title, options); // eslint-disable-next-line react-hooks/exhaustive-deps }, [title, JSON.stringify(options), setTitle]); }; exports.useSetInspectorTitle = useSetInspectorTitle; //# sourceMappingURL=useSetInspectorTitle.js.map