Routing

Page and URL routing

The Datta Able routing system is based on React Router and its package, React Router DOM. It also utilises code splitting for improved performance.

How can I add a new page with a menu item?

You can use the explanation below to add/remove menu routes and their menu items.

Configure route

Open src\routes\index And you will find the example code below. In the code below, we have shown different routes.

src/routes/index.tsx
import { lazy } from 'react';
import { createBrowserRouter } from 'react-router-dom';

// project-imports
...
...

// ==============================|| ROUTING RENDER ||============================== //

const router = createBrowserRouter(
  [
    {
      path: '/',
      element: <SimpleLayout />,
      children: [
        {
          index: true,
          element: <PagesLanding />
        },
        ....
      ]
    },
    ApplicationRoutes,
    AdminPanelRoutes,
    NavigationRoutes,
    ...
  ],
  {
    basename: import.meta.env.VITE_APP_BASE_NAME
  }
);

export default router;

Add a New menu/route

To add one more menu item in <router />, update the following file at the same location src\routes\index

Further, the same menu needed to be added in the respective JSON as well, here: src/menu-items/index

Last updated