Installation
Source URL: https://tanstack.com/query/latest/docs/framework/react/installation
Installation
Section titled “Installation”You can install React Query via NPM,
or a good ol’ <script> via
ESM.sh.
npm i @tanstack/react-queryor
pnpm add @tanstack/react-queryor
yarn add @tanstack/react-queryor
bun add @tanstack/react-queryReact Query is compatible with React v18+ and works with ReactDOM and React Native.
Wanna give it a spin before you download? Try out the simple or basic examples!
If you’re not using a module bundler or package manager, you can also use this library via an ESM-compatible CDN such as ESM.sh. Simply add a <script type="module"> tag to the bottom of your HTML file:
<script type="module"> import React from 'https://esm.sh/react@18.2.0' import ReactDOM from 'https://esm.sh/react-dom@18.2.0' import { QueryClient } from 'https://esm.sh/@tanstack/react-query'</script>You can find instructions on how to use React without JSX here.
Requirements
Section titled “Requirements”React Query is optimized for modern browsers. It is compatible with the following browsers config
Chrome >= 91Firefox >= 90Edge >= 91Safari >= 15iOS >= 15Opera >= 77Depending on your environment, you might need to add polyfills. If you want to support older browsers, you need to transpile the library from
node_modulesyourselves.
Recommendations
Section titled “Recommendations”It is recommended to also use our ESLint Plugin Query to help you catch bugs and inconsistencies while you code. You can install it via:
npm i -D @tanstack/eslint-plugin-queryor
pnpm add -D @tanstack/eslint-plugin-queryor
yarn add -D @tanstack/eslint-plugin-queryor
bun add -D @tanstack/eslint-plugin-query