State-Driven Routing with React, Redux, Selectors
thinkloop.com
thinkloop.com
I appreciate a look into this world, but routing on the web isn't supposed to be very complex. One of the big simplicity wins of the web network architecture was that it was stateless almost everywhere, with hypertext as the engine of application state[1].
Anybody can write some HTML with some anchor tags and tie it to some routes declared in a server-side routing file. The back button will work. History will work. Refresh will work. Copy-and-pasting the URL into an email will work. It's so easy that even I can do it.
[1] https://www.quora.com/How-do-page-load-times-affect-e-commer...
There were and are other options that don't toss the advantages of the the web architecture and return us to the client-server programing paradigm of the 80s & 90s.
Also, what's wrong with the client-side paradigm other than that it's old? The only thing I'm really missing out on is SEO which doesn't matter in a lot of domains.
There are many problems with the client-side paradigm: security, API churn, we lose Rest/HATEOAS, complexity, etc. That's not to say that the client side paradigm is always the wrong choice, it has its strengths as well, but it is rather to say that making it the default choice, without considering the problem at hand, is foolish.
The solution I use[1], and disclaimer also wrote, was targeted directly at server rendered SPA's to follow closely with these ideals. Layers over native anchor tags, just barebones handles the link clicking and uses Express routing which is obviously back end compatible.
* ctrl-clicking to open a new tab
* shift-clicking to open a new window
* alt-clicking
* non-left-clicking
* target attribute in <a>
* mailto: in href
I do like that there is no special integration. A href links just work.
Also, I believe it can be made smaller with one of the other bundlers. Browserify is not the most size conscious choice, it just happens to be the one I have the most experience with.
E.g., the URL to the demo's about page: http://www.thinkloop.com/article/state-driven-routing-react-...