Following are the fundamental building blocks to creating a route.
main.tsx
into App.tsx
and add it
to the imports array.
import React from 'react';
import ReactDOM from "react-dom/client";
import { BrowserRouter, Route, Routes } from "react-router-dom";
import { HelmetProvider } from 'react-helmet-async';
import "./index.scss";
import { Routingdata } from './common/routingdata';
import App from './layout/App';
import Dashboard from './components/dashboard/Dashboard';
import Authenticationlayout from './layout/Authenticationlayout';
import Error500 from './components/pages/authentication/500error';
import Error501 from './components/pages/authentication/501error';
import Error404 from './components/pages/authentication/404error';
import Forgotpassword from './components/pages/authentication/Forgotpassword';
import Lockscreen from './components/pages/authentication/Lockscreen';
import Resetpassword from './components/pages/authentication/Resetpassword';
import Signin from './components/pages/authentication/Signin';
import Signup from './components/pages/authentication/Signup';
import Underconstruction from './components/pages/authentication/Underconstruction';
import Forgetpassword from './layout/firebase/Forgetpassword';
import Firebasesignin from './layout/firebase/Firebasesignin';
import Firebasesignup from './layout/firebase/Firebasesignup';
import Scrolltotop from './Scrolltotop';
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.Fragment>
<HelmetProvider>
<BrowserRouter>
<Scrolltotop/>
<Routes>
{/* main layout */}
<Route path={`${import.meta.env.BASE_URL}`} element={<App />} >
<Route path={`${import.meta.env.BASE_URL}`} element={<Dashboard />} />
{Routingdata.map((idx) => (
<Route path={idx.path} element={idx.element} key={Math.random()} />
))}
</Route>
{/* authentication layout */}
<Route path={`${import.meta.env.BASE_URL}`} element={<Authenticationlayout />}>
{/* <Route index element={<Login />} /> */}
<Route path='*' element={<Error500 />} />
{/* firebase authentication */}
<Route index element={<Firebasesignin/>}/>
<Route path={`${import.meta.env.BASE_URL}firebase/firebasesignin`} element={<Firebasesignin/>}/>
<Route path={`${import.meta.env.BASE_URL}firebase/firebasesignup`} element={<Firebasesignup/>}/>
<Route path={`${import.meta.env.BASE_URL}firebase/forgetpassword`} element={<Forgetpassword />} />
{/* other authentication */}
<Route path={`${import.meta.env.BASE_URL}pages/authentication/500error`} element={<Error500 />} />
<Route path={`${import.meta.env.BASE_URL}pages/authentication/501error`} element={<Error501 />} />
<Route path={`${import.meta.env.BASE_URL}pages/authentication/404error`} element={<Error404 />} />
<Route path={`${import.meta.env.BASE_URL}pages/authentication/forgotpassword`} element={<Forgotpassword />} />
<Route path={`${import.meta.env.BASE_URL}pages/authentication/lockscreen`} element={<Lockscreen />} />
<Route path={`${import.meta.env.BASE_URL}pages/authentication/resetpassword`} element={<Resetpassword />} />
<Route path={`${import.meta.env.BASE_URL}pages/authentication/signin`} element={<Signin />} />
<Route path={`${import.meta.env.BASE_URL}pages/authentication/signup`} element={<Signup />} />
<Route path={`${import.meta.env.BASE_URL}pages/authentication/underconstruction/`} element={<Underconstruction />} />
</Route>
</Routes>
</BrowserRouter>
</HelmetProvider>
</React.Fragment>
);
Following are the fundamental building blocks to creating a new link.
path : (Root: \src\common\sidemenu.tsx)
Ex:
{
title: "Dashboards", icon: 'bi-house', type: "sub", menusub: true, active: false, selected: false, dirchange: false, children:
[
{ path: `${import.meta.env.BASE_URL}maincomponent/dashboards/sales`, type: "link", active: false, selected: false, dirchange: false, title: "Sales", },
],
},