RTK Query vs React Query - which to use in what scenarios?

This page summarizes the projects mentioned and recommended in the original post on /r/reactjs

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • rtk-query

    Discontinued Data fetching and caching addon for Redux Toolkit

  • You can easily invalidate entities/perform optimistic updates from middleware. For example, all of my applications have some type of WS integration that lives in middleware and will dispatch updates that both my application state and network state care about. In this case, I use a type guard such as hasUserPayload + addMatcher in extraReducers resulting in an updated state. (Note: This is not documented yet, but a quick example can be seen in the tests).

  • redux-toolkit

    The official, opinionated, batteries-included toolset for efficient Redux development

  • The first issue is that RTK Query is still technically in alpha atm. We are currently working on finalizing the RTK Query APIs and implementation, and will merge that back into Redux Toolkit once it's ready. That will go out in an upcoming RTK minor release (like 1.6.0). Don't have an exact timeline, but we're probably talking a few weeks to get that wrapped up and also pull together the other changes we're hoping to include in RTK 1.6.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • rtk-query-rq-custom-hooks-conversion

    A conversion of react-query custom hooks to RTK query

  • Regarding boilerplate, I'm not sure where that is coming from. For an older (but still probably accurate) diff, you can check this out. This would be a standard redux setup with redux-toolkit. I can also shave a few lines off of this by just using the ApiProvider assuming no further store configuration is desired. As you can see, there isn't really much of a difference here at all regarding lines of code.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts