Following are the fundamental building blocks to creating a route.
main.tsx into App.tsx 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.tsx';
import Crm from './container/dashboards/crm/crm.tsx';
import Ecommerce from './container/dashboards/ecommerce/ecommerce.tsx';
import Crypto from './container/dashboards/crypto/crypto.tsx'
import Loader from './components/common/loader/loader.tsx';
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.Fragment>
<BrowserRouter>
<React.Suspense fallback={<Loader />}>
<Routes>
<Route path={`${import.meta.env.BASE_URL}/`} element={<App />}>
<Route index element={<Crm />} />
<Route path={`${import.meta.env.BASE_URL}dashboards/crm`} element={<Crm />}/>
<Route path={`${import.meta.env.BASE_URL}dashboards/ecommerce`} element={<Ecommerce />}/>
<Route path={`${import.meta.env.BASE_URL}dashboards/crypto`} element={<Crypto />}/>
</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.tsx
Ex: {
menutitle: 'MAIN',
Items: [
{
icon: (<i className="side-menu__icon ri-home-4-line"></i>),
type: 'sub',
Name: '',
active: false,
selected: false,
title: 'Dashboards',
badge: '',
badgetxt: '12',
class: 'badge bg-warning-transparent ms-2',
children: [
{ path: `${import.meta.env.BASE_URL}dashboards/crm`, type: 'link', active: false, selected: false, title: 'CRM' },
{ path: `${import.meta.env.BASE_URL}dashboards/ecommerce`, type: 'link', active: false, selected: false, title: 'Ecommerce' },
{ path: `${import.meta.env.BASE_URL}dashboards/crypto`, type: 'link', active: false, selected: false, title: 'Crypto' },
{ path: `${import.meta.env.BASE_URL}dashboards/jobs`, type: 'link', active: false, selected: false, title: 'Jobs' },
{ path: `${import.meta.env.BASE_URL}dashboards/nft`, type: 'link', active: false, selected: false, title: 'NFT' },
{ path: `${import.meta.env.BASE_URL}dashboards/sales`, type: 'link', active: false, selected: false, title: 'Sales' },
{ path: `${import.meta.env.BASE_URL}dashboards/analytics`, type: 'link', active: false, selected: false, title: 'Analytics' },
{ path: `${import.meta.env.BASE_URL}dashboards/projects`, type: 'link', active: false, selected: false, title: 'Projects' },
{ path: `${import.meta.env.BASE_URL}dashboards/hrm`, type: 'link', active: false, selected: false, title: 'HRM' },
{ path: `${import.meta.env.BASE_URL}dashboards/stocks`, type: 'link', active: false, selected: false, title: 'Stocks' },
{ path: `${import.meta.env.BASE_URL}dashboards/courses`, type: 'link', active: false, selected: false, title: 'Courses' },
{ path: `${import.meta.env.BASE_URL}dashboards/personal`, type: 'link', active: false, selected: false, title: 'Personal' }
]
}
]
},