Routing
Page and URL routing
Mantis routing system is based on react-router and its package react-router-dom, it's also using code splitting for better performance.
Configure route
Open ...\src\routes\index.jsx You will find the below example code. In the below code we have shown four different routes. <MainRoutes/> is the main layout routing you see after login.
import { lazy } from 'react';
import { createBrowserRouter } from 'react-router-dom';
// project import
...
...
// ==============================|| ROUTING RENDER ||============================== //
const router = createBrowserRouter(
[
{
path: '/',
element: <SimpleLayout layout={SimpleLayoutType.LANDING} />,
children: [
{
index: true,
element: <PagesLanding />
}
]
},
LoginRoutes,
ComponentsRoutes,
MainRoutes
],
{ basename: process.env.REACT_APP_BASE_NAME }
);
export default router;Add a New menu/route in the main layout
To add one more menu item in <MainRoutes />, update the following file at the same location ...\src\routes\MainRoutes.jsx
Any route added in <MainLayout> will automatically go through <AuthGuard>
Further, same menu needed to add in respective Json as well here: src/menu-items
Last updated