January 19, 2018
The heart and soul of a Single Page Application.
A router in React maps different components to different urls in different parts of your UI. Most people use it to control the content of their content area. But you can also use it to change the menu items and other parts of your UI based on the url.
The most popular one is called react-router. React Router works fairly well, even though their latest version was a little bit controversial. Or you could use my friend Asbjørn’s router, I have used it a lot in the past.
I used to use the latter when I started. Because it was easier to hook up. But these days I use React Router. Most of it is good, and it is very flexible for large apps. And you have different versions of it for different uses. Everything from regular routing, to hash to react native. And also a redux version that I think it awesome.