Archived
router
This commit is contained in:
1 parent
6748530535
commit
a1bc781aeb
3 files changed
+148
-6
No files matched your search
+39
-6
@@ -1,7 +1,40 @@
|
||||
import styles from "./App.module.scss";
|
||||
|
||||
function App() {
|
||||
return <div></div>;
|
||||
}
|
||||
|
||||
export default App;
|
||||
import {
|
||||
BrowserRouter as Router,
|
||||
Switch,
|
||||
Route,
|
||||
Link
|
||||
} from "react-router-dom";
|
||||
export default function App() {
|
||||
return (
|
||||
<Router>
|
||||
<div>
|
||||
{/* A <Switch> looks through its children <Route>s and
|
||||
renders the first one that matches the current URL. */}
|
||||
<Switch>
|
||||
<Route path="/about">
|
||||
<About />
|
||||
</Route>
|
||||
<Route path="/users">
|
||||
<Users />
|
||||
</Route>
|
||||
<Route path="/">
|
||||
<Home />
|
||||
</Route>
|
||||
</Switch>
|
||||
</div>
|
||||
</Router>
|
||||
);
|
||||
}
|
||||
|
||||
function Home() {
|
||||
return <h2>Home</h2>;
|
||||
}
|
||||
|
||||
function About() {
|
||||
return <h2>About</h2>;
|
||||
}
|
||||
|
||||
function Users() {
|
||||
return <h2>Users</h2>;
|
||||
}
|
||||
Reference in new issue
Block a user