Learn

Great work! You’ve learned everything you need to know to add front-end routing to your React applications using React Router! To recap, you can now:

  • Install react-router-dom to add it to your React applications
  • Enable routing by wrapping your application’s contents in the BrowserRouter component
  • Make your code more concise by aliasing BrowserRouter component to Router
  • Use the Route component to add routes to your application
  • Use the Route component’s path prop to specify static routes (those without URL parameters, eg. /users) and dynamic routes (those with URL parameters, eg /users/:userId)
  • Access the values of URL parameters using React Router’s useParams hook
  • Declaratively redirect users by rendering React Router’s Redirect component
  • Imperatively redirect users by accessing the history object via the useHistory hook and calling its goForward, goBack, and push methods.
  • Access the value of query parameters using React Router’s useLocation hook

Instructions

If you’d like to compare your solution to ours, you can download our solution here.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?