From da91440034d7651ab986747868efcccc5f46a786 Mon Sep 17 00:00:00 2001 From: Mathias Wagner Date: Fri, 2 Jun 2023 17:00:13 +0200 Subject: [PATCH] Implemented the browser router in the main.jsx --- client/src/main.jsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/client/src/main.jsx b/client/src/main.jsx index 6e6e5f5..724b8c1 100644 --- a/client/src/main.jsx +++ b/client/src/main.jsx @@ -1,9 +1,21 @@ import React from 'react'; import ReactDOM from 'react-dom/client'; import App from './App.jsx'; +import {createBrowserRouter, RouterProvider} from "react-router-dom"; +import {routes} from "@/common/routes/index.jsx"; + +const router = createBrowserRouter([{ + path: "/", + element: , + children: Object.keys(routes).map(key => routes[key]).flat(Infinity).map(route => ({ + index: route.path === '/', + path: route.path === '/' ? undefined : route.path, + element: route.component + })) +}]); ReactDOM.createRoot(document.getElementById('root')).render( - + , ); \ No newline at end of file