Skip to content

Commit

Permalink
refactor: isolates routing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
devgustavosantos committed Jul 15, 2024
1 parent 4800d5b commit 7df728c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 33 deletions.
12 changes: 4 additions & 8 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import { BrowserRouter } from 'react-router-dom';

import { Router } from './Routes';
import { Router } from './Router';
import { Styles } from './styles/index';

function App() {
return (
<BrowserRouter>
<Styles>
<Router />
</Styles>
</BrowserRouter>
<Styles>
<Router />
</Styles>
);
}

Expand Down
27 changes: 27 additions & 0 deletions src/Router.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { BrowserRouter, Route, Routes } from 'react-router-dom';

import { DefaultLayout } from './layout/DefaultLayout';
import { History } from './pages/History';
import { Home } from './pages/Home';

export function Router() {
return (
<BrowserRouter>
<Routes>
<Route
path="/"
element={<DefaultLayout />}
>
<Route
path="/"
element={<Home />}
/>
<Route
path="/history"
element={<History />}
/>
</Route>
</Routes>
</BrowserRouter>
);
}
25 changes: 0 additions & 25 deletions src/Routes.tsx

This file was deleted.

0 comments on commit 7df728c

Please sign in to comment.