Last active
February 14, 2020 20:03
-
-
Save markodayan/4412c5e2367269ce4a76fb63cfd84f3b to your computer and use it in GitHub Desktop.
React Routing Snippets
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
// 1) To ensure that paths are not accidently accessed - use 'exact' attribute on a Route | |
<Route exact path='/' component={Dashboard} /> | |
// 2) If Routing to a functional component, the props of it contain information about the route, check with console.log | |
console.log(props) // in the functional comp -> eg props.match.params to get nav params from URL path | |
console.log(props.match.params); | |
// 3) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment