How can use apollo-client in new react-router loader pattern?

New react-router announced new feature that called action and loader, but they are pure function so i can’t use hooks (ex) uesQuery). I can send client i to singleton object but i’m not sure that is good approach. Give me some ideas!

1 Like

Hi @loki4reddit :wave: welcome to the community forum! Have you seen this post yet?

There are some sample code snippets in there that might be of use :eyes:

Thanks for your help :slight_smile: , but this question is written after i already saw that example. I’m in curious about use hook inside of loader. But hook only support use in component. I’m wondering in this situation what kind of alternative exist thanks!

The preloading feature has been added in the 3.9.0. It’s still experimental but already considered as production ready. It works great with react router loaders pattern. You could check the doc, test it and provide your feedback here #11519. It’ll be stabilized in the 3.10.0 version.
Thanks