64

As these are downloadable from npm with their names with different sizes. In which scenarios we must downloads tanstack react query and for which react-query.

4 Answers 4

74

As far as I can tell the author chose to publish the new v4 version on @tanstack/react-query whilst keeping the v3 version on react-query.

So most likely, you want the latest version, which is @tanstack/react-query.

This is detailed here: https://tanstack.com/query/latest/docs/framework/react/guides/migrating-to-react-query-4#react-query-is-now-tanstackreact-query

Sign up to request clarification or add additional context in comments.

5 Comments

but react-query has more downloads per week than other one. what could be the reason with it, they are more comfortable to work react-query or any other reason can be ?
Thats quite normal. v4 has existed for a relatively small amount of time. The downloads count goes up everytime someone installs v3 as a dependency of an existing project -- its not just a count of the people who included it their project directly recently. Due to this, its likely for historical reasons theres far more projects on v3 yet to be upgraded. Think of all the projects across the globe built on v3 over the years, compared to the amount built on the brand new v4. Those projects dont "automatically" update --- the author has to change the dependency.
(over time, probably a year so, you will notice a shift in the numbers as authors of long-living projects upgrade, and as new users like yourself get onboarded)
I'll add that when a library author changes the version at the same time as the package name -- it accentuates this affect. Because automatic dependency updaters can not catch it. Its quite annoying when this happens; but you are definitely better off going with the new version.
Everything @AdamThomas said is true. GitHub stats "used by" is also way lower for v4, but it'll catch-up :)
19

Tanstack Query, formerly known as React Query v3 (react-query), aims to make the React Query async state manager, available to frameworks beyond React, and comes with a variety of new features.

For example, Tanstack Query exists now for:

  • React @tanstack/react-query (React Query v4)
  • Svelte @tanstack/svelte-query
  • Solid @tanstack/solid-query
  • Vue @tanstack/vue-query

Comments

1

@tanstack/react-query is just the V4 of react-query , you might wanna check up the changelog in order to see what happened https://tanstack.com/query/v4/docs/react/guides/migrating-to-react-query-4 But generally the syntaxes and processes are the same .

Comments

0

they are the same, from the same company. just changed the named upon v4. update. https://tanstack.com/query

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.