Anyone have experiences to share, either using react-query, a different library or particularly painful memories _not_ using a comparable library?
Anyone have experiences to share, either using react-query, a different library or particularly painful memories _not_ using a comparable library?
I migrated a project to it from react query last year as we liked the react query style hooks and some of its behaviour, but found our usage of react query was getting a bit messy when we started adding dozens and dozens of more endpoints in a large app. Lots of things felt spread out and duplicated, we wanted to centralise things a bit (and simplify the typing) without adding a ton of custom hooks or abstractions
With RTK Query we got to move all the endpoint definitions, cache invalidation behaviour (we had many endpoints that used parameters from many other endpoint responses) and TS definitions to a single place. Also it uses redux underneath so we got the redux tools as well
I'd still use either projects again in the future, just depends on the project
RTK Query felt really good when dealing with a ton of microservices, but maybe overkill if you don't have a ton of endpoints where responses feed into other request parameters
It's cool that it's ALSO a general pattern for any async call, but it's really heavy for just that if you don't want the caching and stuff.
Personally I'm just sticking with MobX and more straightforward fetching mechanics.
If at any point anyone goes like "oh it doesn't seem to support this, we'll have to write some wrappers/custom stuff", take a step back and read the docs again or ask around - the library in general takes care of everything it should and gets out of the way really well otherwise.
Happy to help with this.
Debouncing (for interactive form validations) seems to be something that you still have to sort out yourself.
And I'm not sure how much work the mutation support saves in practice (compared to the extremely sophisticated Apollo cache).
Once you need query invalidation it gets really useful.
But it also depends how you use fetch right now. If you do it on per-route basis, than react query might not bring a lot of benefits.
The only option I saw was to wrap `useQuery` so that you can do custom shenanigans like hooking up the abort signal to the fetch requests.
[0] https://the-guild.dev/openapi/fets/client/quick-start [1] https://openapi-ts.pages.dev/openapi-fetch/
Now I just fetch the data again.
Simple.