Archived
41 lines
825 B
JavaScript
41 lines
825 B
JavaScript
import styles from "./App.module.scss";
|
|
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>;
|
|
}
|