Using react-router-dom
Adding react-router-dom
is a piece of cake by now. Just take yarn
or npm
and add it to your project. Let's get started with our boilerplate code. Copy all of the starter files. We already added react-router-dom
to our app in Chapter 3, Routing, and Chapter 4, The Concept of Immutability. If your app does not have react-router-dom
, you can add it as follows:
yarn add react-router-dom --exact OR npm install react-router-dom
In our health application, we will have the following pages:
Page Description | Page Component | Page Routes |
Home page |
|
|
About page |
|
|
Contact page |
|
|
Register page |
|
|
Login page |
|
|
Forget password |
|
|
Reset password |
|
|
Dashboard page |
|
|
List of users |
|
|
View single user |
|
|
Edit single user |
|
|
Table 6.1: List of routes under consideration
The react-router-dom
...