Next, we will develop the Login page. This requires us to use a different path for each page. For instance, the Register page can be served under the path /register
, and the Login page under the /login
path. For this, we need a router. On the server, we use Express to route the request hitting our API; for the frontend, we need a client-side router to do the same. In the React ecosystem, the most mature router is React Router. Let's install it:
$ yarn add react-router react-router-dom
react-router
provides the core functionality, and react-router-dom
allows us to use the React Router on the web. It's similar to how React on the web is split into react
and react-dom
.