Skip to content

Commit

Permalink
update routing from v5 to v6
Browse files Browse the repository at this point in the history
  • Loading branch information
nesmon committed Mar 21, 2023
1 parent 5e9df0c commit 105e4e2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
22 changes: 7 additions & 15 deletions src/main.jsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './Route/Index/Index';
import Score from './Route/Score/Score';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import {
createBrowserRouter,
RouterProvider
} from "react-router-dom";
import Router from './router.jsx';


const Routing = () => {
return(
<Router>
<Routes>
<Route path="/" element={<App />} />
<Route path="/score/:chartId" element={<Score />} />
</Routes>
</Router>
)
}
const router = createBrowserRouter(Router);

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
<React.StrictMode>
<Routing />
<RouterProvider router={router} />
</React.StrictMode>
);

15 changes: 15 additions & 0 deletions src/router.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import App from './Route/Index/Index';
import Score from './Route/Score/Score';

const router = [
{
path: "/",
element: <App />,
},
{
path: "/score/:chartId",
element: <Score />,
}
]

export default router;

0 comments on commit 105e4e2

Please sign in to comment.