Adding a New Route

This guide walks you through adding a new route in your react-router-dom setup.

1. Create a New Page Component
// src/pages/AboutUs.jsx
import React from "react";

const AboutUs = () => {
    return (
        

About Us

Welcome to the About Us page.

); }; export default AboutUs;
2. Add the Route in allRoutes.jsx
// src/routes/allRoutes.jsx
import AboutUs from "@src/pages/AboutUs";

const routes = [
    { path: "/", component: <DashboardsPage /> },
    { path: "/about-us", component: <AboutUs /> }, // ✅ Sidebar enabled
];

const nonAuthRoutes = [
    { path: "/page/contact-us", component: <ContactUs /> },
    { path: "/auth", component: <Auth /> }, // ✅ No sidebar
];

export { routes, nonAuthRoutes };
  
3. Ensure the Routing Component Applies Changes
// src/routes/Routing.jsx

import { Route, Routes } from "react-router-dom";
import { nonAuthRoutes, routes } from "./allRoutes";
import NonLayout from "@src/layout/nonLayout";
import Layout from "@src/layout/layout";

const Routing = () => {
    return (
        <Routes>
            {/* Routes with Sidebar & Topbar */}
            {routes.map((item, key) => (
                <Route key={key} path={item.path} element={<Layout>{item.component}</Layout>} />
            ))}

            {/* Routes without Sidebar & Topbar */}
            {nonAuthRoutes.map((item, key) => (
                <Route key={key} path={item.path} element={<NonLayout>{item.component}</NonLayout>} />
            ))}
        </Routes>
    );
};

export default Routing;
  
4. Use Routing in App.jsx
//  src/App.jsx
import { BrowserRouter } from "react-router-dom";
import Routing from "./routes/Routing";

function App() {
    return (
        <Routing />
    );
}

export default App;  
5. Verify the New Route

Open your browser and go to:

Receive the latest updates directly in your inbox!

Be the first to know about new updates and exclusive discounts. No spam, just great offers!

How about

A Custom Project?

With over 7 years of experienced team, we specialize in delivering custom projects for startups, blue-chip companies, and government agencies. We have successfully completed over 250+ projects, providing tailored solutions that meet the unique needs of each client.

Hire Us
Domiex Admin & Dashboards
230+

Total Pages

5+

Layouts

11+

Application

We provide quick support withing one business day to all of our customers.

© Domiex Created & Crafted by SRBThemes.