Created
January 3, 2024 06:13
-
-
Save teerasej/7a0925bf2bf25391e87e140bebb46cbe to your computer and use it in GitHub Desktop.
Setting basename property for Browser Router component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import './App.css' | |
import { BrowserRouter as Router, Route, Routes, Link } from 'react-router-dom' | |
import { Home } from './pages/Home' | |
import { Setting } from './pages/Setting' | |
function App() { | |
return ( | |
<> | |
<Router basename='/vite-react-app-deploy-lab'> | |
<div> | |
<h1>Menu</h1> | |
<Link to="/">Home</Link> | |
<Link to="/setting">Setting</Link> | |
</div> | |
<Routes> | |
<Route path="/" Component={Home} /> | |
<Route path="/setting" Component={Setting} /> | |
</Routes> | |
</Router> | |
</> | |
) | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment