Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

installation.md

65 lines2.0 KB

1---
2id: installation
3title: Installation
4---
5​
6You can install React Query via [NPM](https://npmjs.com/),
7or a good ol' `<script>` via
8[ESM.sh](https://esm.sh/).
9​
10> v5 is currently available as a release-candidate. We don't anticipate any major API changes from here on out. We encourage you to try it out and report any issues you find.
11​
12### NPM
13​
14```bash
15$ npm i @tanstack/react-query
16# or
17$ pnpm add @tanstack/react-query
18# or
19$ yarn add @tanstack/react-query
20```
21​
22React Query is compatible with React v18+ and works with ReactDOM and React Native.
23​
24> Wanna give it a spin before you download? Try out the [simple](../examples/react/simple) or [basic](../examples/react/basic) examples!
25​
26### CDN
27​
28If 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](https://esm.sh/). Simply add a `<script type="module">` tag to the bottom of your HTML file:
29​
30```html
31<script type="module">
32 import React from 'https://esm.sh/react@18.2.0'
33 import ReactDOM from 'https://esm.sh/react-dom@18.2.0'
34 import { QueryClient } from 'https://esm.sh/@tanstack/react-query'
35</script>
36```
37​
38> You can find instructions on how to use React without JSX [here](https://react.dev/reference/react/createElement#creating-an-element-without-jsx).
39​
40### Requirements
41​
42React Query is optimized for modern browsers. It is compatible with the following browsers config
43​
44```
45Chrome >= 91
46Firefox >= 90
47Edge >= 91
48Safari >= 15
49iOS >= 15
50opera >= 77
51```
52​
53> Depending on your environment, you might need to add polyfills. If you want to support older browsers, you need to transpile the library from `node_modules` yourselves.
54​
55### Recommendations
56​
57It is recommended to also use our [ESLint Plugin Query](./eslint/eslint-plugin-query) to help you catch bugs and inconsistencies while you code. You can install it via:
58​
59```bash
60$ npm i -D @tanstack/eslint-plugin-query
61# or
62$ pnpm add -D @tanstack/eslint-plugin-query
63# or
64$ yarn add -D @tanstack/eslint-plugin-query
65```