@premieroctet/next-admin
Version:
Next-Admin provides a customizable and turnkey admin dashboard for applications built with Next.js and powered by the Prisma ORM. It aims to simplify the development process by providing a turnkey admin system that can be easily integrated into your proje
21 lines (20 loc) • 643 B
JavaScript
import { jsx } from "react/jsx-runtime";
import { createContext, useContext } from "react";
const RouterContext = /*#__PURE__*/ createContext({
router: ()=>{
throw new Error("RouterAdapterProvider is not initialized");
}
});
const createRouterAdapter = (routerHook)=>function({ children }) {
return /*#__PURE__*/ jsx(RouterContext.Provider, {
value: {
router: routerHook
},
children: children
});
};
const useRouterAdapter = ()=>{
const { router } = useContext(RouterContext);
return router();
};
export { createRouterAdapter, useRouterAdapter };