React Router

Let’s get a brief overview of the React router and its building blocks.

In the backend, we need routing to handle different endpoints and access the resources of the application. In the frontend, we still need routing but to handle different views. Here’s what a typical user expects from a website:

  • Each view has a different URL so that the user can return to, share, or bookmark the page—for example, https://www.educative.io/explore.

  • Navigation through different views doesn’t require a rerendering of the whole page.

  • Browser history is expected to be error free so that the user can go back and forth easily.

To achieve these routing behaviors, we need to keep track of the browser URL so that we can render a proper view for each URL. The React Router handles the hard part for us, so we can easily integrate routing into a React application.

Get hands-on with 1200+ tech skills courses.