UNPKG

ra-core

Version:

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

17 lines 851 B
import * as React from 'react'; import { BasenameContextProvider } from "./BasenameContextProvider.js"; import { useRouterProvider } from "./RouterProviderContext.js"; /** * Creates a Router unless the app is already inside existing router. * Also creates a BasenameContext with the basename prop. * * Uses the RouterWrapper from the configured routerProvider to create * the appropriate router type (HashRouter by default with react-router). */ export const AdminRouter = ({ basename = '', children }) => { const { RouterWrapper, useInRouterContext } = useRouterProvider(); const isInRouter = useInRouterContext(); return (React.createElement(BasenameContextProvider, { basename: isInRouter ? basename : '' }, React.createElement(RouterWrapper, { basename: basename }, children))); }; //# sourceMappingURL=AdminRouter.js.map