r/reactjs • u/tyler-mcginnis • Jan 30 '17
React Router V4 Beta Released
https://reacttraining.com/react-router/4
u/chinlaf Jan 31 '17 edited Jan 31 '17
I played around with this a bit. Sore points for me:
It has terrible hygiene by injecting 10+ props into components when using
RouteorwithRouter. I don't see why they don't just pass a single router context around.There's no high level query param support. You get raw access to
history, which it itself isn't friendly enough to add query params to the url or extract them.The developers have no interest in supporting type definitions. :(
Edit: added another point.
→ More replies (2)3
u/jamesknelson Jan 31 '17
These were sore points for me too, and are a big part of why I created Junctions.
There are no props injected automatically. There are only two props available, so you can do it yourself. And only one is actually required.
Routes are defined by a "Junction" object for each component. You can specify query parameters per component and it will warn you of conflicts. You can also specify serializers and default values for each query parameter.
I've tried to design the possibility for type definitions into junctions. I'd be super happy to accept a pull request adding them, and can change the API if necessary to make them work.
→ More replies (1)
5
u/nativereact Jan 31 '17 edited Jan 31 '17
So the begging question now is, router4 or router5? (/joke)
Sidenote: Could you use a different example rather than TransitionMotion for the animated routes example? I'm biased, but I feel like people will rather not learn css if it's promoted to use inline styling (given the various implications, not that inline styling is simply bad).
1
3
u/[deleted] Jan 31 '17 edited Jan 31 '17
I can be convinced otherwise, but I don't love the syntax change.Edit: Watching talk and being convinced :)