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 743 B
import { createContext, useContext } from 'react'; export var HasDashboardContext = createContext(false); export var HasDashboardContextProvider = HasDashboardContext.Provider; /** * Returns true if the app has a dashboard defined at the <Admin> level. * * @private * @example * import { useHasDashboard } from 'react-admin'; * * const MyMenu = () => { * const hasDashboard = useHasDashboard(); * return ( * <Menu> * {hasDashboard && <DashboardMenuItem />} * <MenuItemLink to="/posts" /> * <MenuItemLink to="/comments" /> * </Menu> * ); * } */ export var useHasDashboard = function () { return useContext(HasDashboardContext); }; //# sourceMappingURL=HasDashboardContext.js.map