-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react-router@4 compatibility #193
Comments
No plans. React Router v4 takes an approach to routing that's fundamentally incompatible with what I want to accomplish here w/r/t data fetching. |
Thanks for the clarification. So, the goal is to stick with RR3? Drop RR in favor of Relay router? |
There will be something different coming. |
@taion I would love to know what that is. I depend on your library, as well as the isomorphic relay router library. Hopefully it won't involve a terrible amount of churn. It's a pain having to deal with that in React Router as it is. Are you planning on making an announcement in the short term? |
For the time being, please continue to use RRv2. That's what I'll be doing for the time being, as RRv2 largely satisfies my needs, and it's not like it's going to stop working just because there's a release out with a larger version number. If you want to track what's happening, keep an eye on https://github.com/4Catalyzer/found/tree/initial-impl and https://github.com/4Catalyzer/farce. The latter looks roughly how I want it to look, I think, but the former is under active development – I haven't even figured out how all the API points should tie together yet. found is going to look pretty similar to RRv2, but the insides will be a bit different and should make it easier to show loading indicators when using async |
@ooflorent @jameslk u can use this snippet: https://gist.github.com/janicduplessis/f513032eb37cdde5d050d9ce8cf0b92a that will wrap any route component inside a |
That's a quite bad idea, BTW – it will make all of your loads unavoidable waterfall. Unfortunately the sort of component composition in RRv4 just isn't a good model for async data fetching with routing. So don't do that unless you actively want to delivery poor UX. |
I recently migrated from react-router to http://grahammendick.github.io/navigation/ The migration was smooth, and the library is super tiny. I also like to hear @taion 's view on the library as he is one of the most knowledgeable in react + relay + react-router. thanks in advance. |
@taion Any updates on the RRv4 support for Relay applications? Or is RRv3 still the recommended approach? |
Nothing from earlier in the thread has changed. |
@taion - I know this is a really old comment that I made here: But I'm resurfacing it because I want validation that I'm not doing something that is going to get me into trouble later.
I have been using the above technique to use relay-modern with react-router@4 without nesting |
The issue is more like – suppose you have multiple routes that need different data. Presumably you're doing the data fetching in a parent component, but how does that parent component know what query it should run, and which data it should fetch? Like it's fine if you only have a single possible route, but otherwise you need to determine all your data dependencies in the ultimate parent, and if there are multiple possible sets of child routes with different data dependencies, you somehow need to sort all of that out on the parent. |
I see, could that be solved with refetch containers somehow? |
Each component, just needs to know which of it's immediate children will be rendered. Then it would have to refetch with different fragments spread. I can see how it gets complicated. |
Plus you're refetching, and these are exactly the waterfalled requests that by presumption we don't want. |
So is found-relay your recommended solution? |
Correct. It's roughly the same API as React Router Relay, but has better support around things like async components, showing loading indicators, and redirecting or hitting 404s based on Relay data. |
@taion Thoughts on react-router-config? It gives RRv4 the ability to have static route configuration again. With react-router-config, would there be some consideration in making react-router-relay compatible with RRv4? |
It's okay-ish for some use cases, but ultimately it's not a great solution. It's feature-incomplete as a config-based router. In essence you end up just dropping all the core routing functionality in React Router v4, and rebuilding in a sort of messy way the v3 API. You don't get any of the benefits of the dynamic component-based routing, but you also don't get the sort of full-fledged config-based routing API, because it's sort of awkward to build on top of that system. In the end, all you really get is a weird sort of wrapper around My recommendation remains to switch to Found and Found Relay. |
Marked |
The current API of
react-router-relay
seems to be incompatible withreact-router@4
.Is there any plan for supporting it?
The text was updated successfully, but these errors were encountered: