a conventional router for React

(Zhong Yu) #1

This is a more conventional approach to client-side routing, similar to server-side solutions.

While react-router v4 is pretty magical, I personally prefer the bottom-up approach, that is, locate the bottom page at the page hierarchy, determine everything it needs, and build the entire view. I think this is easier for dependency management.

Because of back-button, a page can be requested to be re-shown, when the application state has changed. Therefore a request-handler may be needed, to re-examine the state every time the page is requested, and take different actions.

Also, pages are referenced by their types, instead of URLs. URL is rather an external address of a page; it’s not needed internally in app coding.