Made router work

This commit is contained in:
2025-01-11 21:25:17 -06:00
parent 1ebbb16677
commit 643b8cfbcc
6 changed files with 40 additions and 12 deletions
+1
View File
@@ -10,6 +10,7 @@
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router": "^7.1.1",
"react-router-dom": "^7.1.1"
},
"devDependencies": {
+1
View File
@@ -12,6 +12,7 @@
"dependencies": {
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router": "^7.1.1",
"react-router-dom": "^7.1.1"
},
"devDependencies": {
+9 -10
View File
@@ -1,21 +1,20 @@
import './App.css'
import { Link } from 'react-router-dom';
import { Routes, Route} from 'react-router';
import Home from './pages/home.tsx';
import Inventory from "./pages/inventory.tsx";
function App() {
return (
<>
<div>
<h1>BarkMan</h1>
</div>
<p>
ARFF ARFF BARK BARK
</p>
<Routes>
<Route index element={<Home />} />
<Route path="inventory" element={<Inventory />} />
</Routes>
<Link to="/inventory">
<button>Inventory</button>
</Link>
</>
)
}
+4 -1
View File
@@ -2,9 +2,12 @@ import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import './index.css'
import App from './App.tsx'
import { BrowserRouter } from "react-router";
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
<BrowserRouter>
<App />
</BrowserRouter>
</StrictMode>,
)
+24
View File
@@ -0,0 +1,24 @@
import '../App.css'
import {Link} from "react-router";
function Home() {
return (
<>
<div>
<h1>Home</h1>
</div>
<p>
ARFF ARFF BARK BARK
</p>
<Link to="/inventory">
<button>Inventory</button>
</Link>
</>
)
}
export default Home
@@ -1,4 +1,4 @@
import './App.css'
import '../App.css'
function Inventory() {