Comparison

RTK Query takes inspiration from many other data fetching libraries in the ecosystem. Much like the Redux core library was inspired by tools like Flux and Elm, RTK Query builds on API design patterns and feature concepts popularized by libraries like React Query, SWR, Apollo, and Urql. RTK Query has been written from scratch, but tries to use the best concepts from those libraries and other data fetching tools, with an eye towards leveraging the unique strengths and capabilities of Redux.

It's worth comparing the feature sets of all these tools to get a sense of their similarities and differences.

info

This comparison table strives to be as accurate and as unbiased as possible. If you use any of these libraries and feel the information could be improved, feel free to suggest changes (with notes or evidence of claims) by opening an issue.

Featurertk-queryreact-queryapollourql
Supported Protocolsany, REST includedany, none includedGraphQLGraphQL
API Definitiondeclarativeon use, declarativeGraphQL schemaGraphQL schema
Cache byendpoint + serialized argumentsuser-defined query-keytype/idtype/id?
Invalidation Strategy + Refetchingdeclarative, by type and/or type/idmanual by cache keyautomatic cache updates on per-entity level, manual query invalidation by cache keydeclarative, by type OR automatic cache updates on per-entity level, manual query invalidation by cache key
Polling yesyesyesyes
Parallel queries yesyesyesyes
Dependent queriesyesyesyesyes
Skip queriesyesyesyesyes
Lagged queriesyesyesno?
Auto garbage collectionyesyesno?
Normalized cachingnonoyesyes
Infinite scrollingTODOyesrequires manual code?
Prefetchingyesyesyesyes?
Retryingyesyesrequires manual code?
Optimistic updatescan update cache by handcan update cache by handoptimisticResponse?
Manual cache manipulationyesyesyesyes
Platformshooks for React, everywhere Redux workshooks for Reactvariousvarious