Implementing simple react router
1 min readJan 8, 2019
how to implement a react router in line
We can implement react router in a single line using array of routes and that have component mapped to pathname. The window.location.pathname can be used as key to return view.
The react component can be used to implement this the following code snippet explains how to do this in react