Skip to content

Instantly share code, notes, and snippets.

@mdflynn
Last active December 5, 2020 23:58
Show Gist options
  • Save mdflynn/ae9dede25dcbdc60a6b5dac17d61b57a to your computer and use it in GitHub Desktop.
Save mdflynn/ae9dede25dcbdc60a6b5dac17d61b57a to your computer and use it in GitHub Desktop.

1. What package do we need to install to use React Router?

react-router-dom

2. What is a ?

It is a router component that uses regular URL paths.

3. Why would we use in our apps?

It allows our apps to act as a multi-page app using forward/back buttons as well as bookmarked pages.

4. What does the component do?

It renders some UI when its path matches the current URL.

5. How does the component check whether it should render something?

It checks to see if the URL matches its path and will render that component if there's a match.

6. What does the component do?

It renders the first child Route or Redirect that matches the location. It's ment to render nested routes properly.

7. How does it decide what to render?

It checks each Route components and if the URL matches the path, it will render that and only that component.

8. What does the component do? How does a user interact with it?

The Link component creates links in our app. An tag is rendered in our app. The user clicks on it.

9. What does the component do? How does a user interact with it?

A special version of the that will add styling attributes to the rendered element when it matches the current URL.

10. What does the component do?

It redirects to a route that is specified and renders that component. It can be good for handling error issues and redirected to error pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment