Following are the fundamental building blocks to creating a route.
index.js
into App.js
and add it
to the imports array.
import React, { Fragment } from "react";
import ReactDOM from "react-dom/client";
import { BrowserRouter, Route, Routes } from "react-router-dom";
//component import
const Dashboard = React.lazy(() => import("./components/Dashboard/Dashboard"))
const App = React.lazy(() => import("./components/app"));
<
Fragment>
<
BrowserRouter>
<
React.Suspense fallback={Loader()}>
<
Routes>
<
Route path={`${process.env.PUBLIC_URL}/`}
element={ }>
<
Route index element={<
Dashboard />} />
<
Route>
<
Route
path={`${process.env.PUBLIC_URL}/Dashboard`}
element={<
Dashboard />}
/>
<
/Route>
{/* crytocurrency */}
<
Route>
<
Route
path={`${process.env.PUBLIC_URL}/crytocurrencies/buysell`}
element={<
Buysell />}
/>
<
Route
path={`${process.env.PUBLIC_URL}/crytocurrencies/dashboard`}
element={<
LazyCryptoDashboard />}
/>
<
Route
path={`${process.env.PUBLIC_URL}/crytocurrencies/market`}
element={<
MarketCap />}
/>
<
Route
path={`${process.env.PUBLIC_URL}/crytocurrencies/currencyechange`}
element={<
LazyCurrencyExchange />}
/>
<
Route
path={`${process.env.PUBLIC_URL}/crytocurrencies/transcations`}
element={<
Transcations />}
/>
<
Route
path={`${process.env.PUBLIC_URL}/crytocurrencies/wallet`}
element={<
Wallet />}
/>
<
/Route>
<
/Routes>
<
/React.Suspense>
<
/BrowserRouter>
<
/Fragment>
Following are the fundamental building blocks to creating a new link.
├── src
├──layouts
├──Sidebar
├──SideMenu.js
export const MENUITEMS = [
{
menutitle: 'DASHBOARD',
Items: [
{
path: `${process.env.PUBLIC_URL}/dashboard`,
icon: 'ti-home',
type: 'link',
active: false,
selected: false,
title: 'Dashboard'
},
{
title: 'CryptoCurrencies',
icon: 'ti-wallet',
type: 'sub',
active: false,
selected: false,
children: [
{
path: `${process.env.PUBLIC_URL}/crytocurrencies/dashboard`,
type: 'link',
active: false,
selected: false,
title: 'Dashboard'
},
{
path: `${process.env.PUBLIC_URL}/crytocurrencies/market`,
type: 'link',
active: false,
selected: false,
title: 'Marketcap'
},
{
path: `${process.env.PUBLIC_URL}/crytocurrencies/currencyechange`,
type: 'link',
active: false,
selected: false,
title: 'Currency exchange'
},
]
},
]
}
]