The compositional pattern of the React.js library makes Single Page Application (SPA) development easier. The most important need of SPA is an implementation of Routing in the app. Since React.js does not have any built-in routing support, we can install the react-router-dom library which provides a set of objects to enable router functionality for React applications.
The react-router-dom provides some of the following important classes:
1. Router - the common low level interface for all router components. This contains the route expression to the components using the following properties:
- path - this property contains the URL used for navigating to a component.
- component - name of the component to navigate to.
- exact - when the property value is true, this will navigate only when the path exactly matches the location.pathname .