Last active
June 24, 2020 21:23
-
-
Save lwcooper/a82719c253267a2dc1ade6f54d508f71 to your computer and use it in GitHub Desktop.
react router
This file contains hidden or 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
{/* 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> |
This file contains hidden or 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
export default function App() { | |
return ( | |
<Router> | |
<div> | |
// all my stuff | |
</div> | |
</Router> | |
); | |
} |
This file contains hidden or 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 React from "react"; | |
import { | |
BrowserRouter as Router, | |
Switch, | |
Route, | |
Link | |
} from "react-router-dom"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment