4 ms·
I migrated away from react-router because from v3 to v4 broke everything that made sense. Things became wildly more complicated. I'm now extremely happy with m
by artellectual 8y ago
I migrated away from react-router because from v3 to v4 broke everything that made sense. Things became wildly more complicated.
I'm now extremely happy with my new router of choice router5 (not to be confused with React Router 5) https://router5.js.org https://router5.js.org.
- Androider 8y agoThank you, this looks excellent! Finally a router that doesn't force you to define your UI by splitting everything up into their top-level view components. I want the router to give me the state, and then get the hell out of the way so I can fully manage the UI myself. I've had a look at react-router multiple times over the years, and the best thing going for them seems to have been that they managed to squat that generic name early on. From the docs and GitHub, it's always been abundantly clear that the "current version sucks, mistakes were made, next version will totally fix everything" again and again.
- dmitriid 8y agoRouter5 is awesome (but needs some getting used to). I remember being so fed up with React Router that I spent sometime implementing some functionality that existed in React Router before 1.x, and that still is missing (like route names). And used router5 for that. Didn't even need that many hacks: https://gist.github.com/dmitriid/675ceff4bd07ec6cdf06a560d7262407 https://gist.github.com/dmitriid/675ceff4bd07ec6cdf06a560d72...
- whs 8y agoI tried router5 in our team and found that while it is more powerful, 1. Having to write middleware for many things is quite hard for junior devs, as it requires deep understanding of how router works. (We have middleware for dependency injection, MobX per-page store, data fetching, auth check) 2. Due to the tree-based router design, some routes are impossible. See https://github.com/troch/route-node/issues/17 https://github.com/troch/route-node/issues/17 https://github.com/troch/route-node/issues/18 https://github.com/troch/route-node/issues/18 I still haven't found router of my choice yet. Maybe router5 without route-note could work for me, but I still wouldn't recommend it to any team.
- Keats 8y agoI did the same thing, although I might have migrated before v3. I wrote 2 articles about it in case it can help someone: - https://www.vincentprouillet.com/blog/testing-a-different-spa-routing/ https://www.vincentprouillet.com/blog/testing-a-different-sp... - https://www.vincentprouillet.com/blog/testing-a-different-spa-routing-update/ https://www.vincentprouillet.com/blog/testing-a-different-sp... It probably changed a bit since those articles but I was happy with it. A very simple codebase using that can be seen on https://github.com/Keats/hn-react https://github.com/Keats/hn-react
- SaturateDK 8y agoOh, this looks promising. I'm pretty tired of react-router, and I like to keep my navigation in my redux state, as it's a big part of any application state in my mind. How well does router5 work with redux? I see they have an official package for it, so it's looking good, but maybe you have first hand experience.
- eatonphil 8y agoVery well. We've been using it for 1.5yr at work, keeping up-to-date with latest React and Redux.
- eatonphil 8y agoUsed v3 a few years ago at Linode and it was ok, if overly complex. The API changes resulting in v4 were so great that it basically became an entirely new project -- and the v4 docs are _still_ incomplete/not very helpful. Faced with learning a new project anyway I went with router5 at Capsule8. Not only is router5's API simple, well-documented and easily programmable, the router5 folks have been receptive to feedback and pull requests. They also keep fairly well up-to-date compared to react-router (router5 supports React hooks, react-router doesn't yet). I'm content with the direction and design of router5 and encourage others to check it out.
- sickcodebruh 8y agoI’m still on v3 for that reason. On the surface, the immediate value proposition of v4 makes sense: use actual React Components instead of things that look like components but are not. In practice, it introduced so many breaking changes that, to me, it’s always felt like a solution to a problem that didn’t really exist.
- mmgutz 8y agoWhat I dislike most about React Router is how it pollutes rendering logic. They say it makes routing declarative. A switch statement is not declarative.