Following are the fundamental building blocks to creating a route.
main.jsx
into App.jsx
and add it
to the imports array.
import React, { Fragment, lazy } from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter, Route, Routes } from 'react-router-dom';
//component import
import App from './pages/App.jsx';
import Dashboard from './container/dashboard/dashboard.jsx';
import Cards from './container/app/cards/cards.jsx';
ReactDOM.createRoot(document.getElementById('root')).render(
<
React.Fragment>
<
BrowserRouter>
<
Routes>
<
Route index element={<
App />} />
<
Route path={`${import.meta.env.BASE_URL}dashboard`} element={ } />
<
Route path={`${import.meta.env.BASE_URL}app/cards`} element={ } />
<
/Route>
<
/Routes>
<
/React.Suspense>
<
/BrowserRouter>
<
/Fragment>
)
Following are the fundamental building blocks to creating a new link.
├── node_modules
├── src
├──components
├──common
├──sidebar
├──sidemenu
├──sidemenu.jsx
export const MenuItems = [ {
{
path: `${import.meta.env.BASE_URL}dashboard`,
icon: (<
i className="fe fe-airplay side-menu__icon"><
/i>)
type: "link",
selected: false,
active: false,
title: "Dashboard",
},
{
icon: (<
i className="fe fe-box side-menu__icon"><
/i>)
type: "sub",
Name: "",
active: false,
selected: false,
badge: "",
badgetxt: "",
class: "",
title: "Apps",
children: [
{
path: `${import.meta.env.BASE_URL}app/cards`,
title: "Cards",
type: "link",
active: false,
selected: false,
},
]
}
}
]