We have to use routing in client-side applications. For ReactJS we also need another routing library, so I recommend you use
react-router, which is provided by the React community.
The advantages of React routing are:
- Viewing declarations in a standardized structure helps us to instantly identify our app views
- Lazy code loading
react-router, we can easily handle the nested views and their progressive resolution of views
- Using the browsing history feature, a user can navigate backwards/forwards and restore the state of the view
- Dynamic route matching
- CSS transitions on views when navigating
- Standardized app structure and behavior, useful when working in a team
The React router doesn't provide any way to handle data fetching. We need ...