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

installation.md

77 lines1.9 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[unpkg.com](https://unpkg.com).
9​
10### NPM
11​
12```bash
13npm i @tanstack/react-query@4
14```
15​
16or
17​
18```bash
19pnpm add @tanstack/react-query@4
20```
21​
22or
23​
24```bash
25yarn add @tanstack/react-query@4
26```
27​
28React Query is compatible with React v16.8+ and works with ReactDOM and React Native.
29​
30> Wanna give it a spin before you download? Try out the [simple](/query/v4/docs/framework/react/examples/simple) or [basic](/query/v4/docs/framework/react/examples/basic) examples!
31​
32### CDN
33​
34If you're not using a module bundler or package manager we also have a global ("UMD") build hosted on the [unpkg.com](https://unpkg.com) CDN. Simply add the following `<script>` tag to the bottom of your HTML file:
35​
36```html
37<script src="https://unpkg.com/@tanstack/react-query@4/build/umd/index.production.js"></script>
38```
39​
40Once you've added this you will have access to the `window.ReactQuery` object and its exports.
41​
42> This installation/usage requires the [React CDN script bundles](https://reactjs.org/docs/cdn-links.html) to be on the page as well.
43​
44### Requirements
45​
46React Query is optimized for modern browsers. It is compatible with the following browsers config
47​
48```
49Chrome >= 73
50Firefox >= 78
51Edge >= 79
52Safari >= 12.1
53iOS >= 12.2
54Opera >= 53
55```
56​
57> 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.
58​
59### Recommendations
60​
61It 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:
62​
63```bash
64npm i -D @tanstack/eslint-plugin-query@4
65```
66​
67or
68​
69```bash
70pnpm add -D @tanstack/eslint-plugin-query@4
71```
72​
73or
74​
75```bash
76yarn add -D @tanstack/eslint-plugin-query@4
77```