|
|
|
|
|
by audessuscest
981 days ago
|
|
I've been using React-query on several projects including the v5 on a recent one.
On a new project I decided to give a try to RTK (Redux ToolKit), I must say there's not much reason to not use RTK over a lib like react-query. You basically have the same and more, and all the advantages of using react-redux.
It felt backward at first to come back to Redux after all this time, but I'm glad I did, and can't recommend it enough. (and the project is still active) |
|
In fact, the React Query and Redux maintainers cross-recommend each other's libraries. If you're _not_ using Redux in an app, use React Query for your data fetching. If you _are_ using Redux in an app, use RTK Query for your data fetching.
(There are some differences in features and API design that might be a reason to use RTK Query even if you're not using Redux for client-side state management, such as the OpenAPI/GraphQL codegens, auto-generated React hooks, etc [1] )
[0] https://redux-toolkit.js.org/rtk-query/overview
[1] https://redux.js.org/tutorials/essentials/part-7-rtk-query-b...
[2] https://redux-toolkit.js.org/rtk-query/comparison