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

installation.md

49 lines1.4 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
13$ npm i @tanstack/react-query
14# or
15$ pnpm add @tanstack/react-query
16# or
17$ yarn add @tanstack/react-query
18```
19​
20React Query is compatible with React v16.8+ and works with ReactDOM and React Native.
21​
22> Wanna give it a spin before you download? Try out the [simple](/query/v4/docs/examples/react/simple) or [basic](/query/v4/docs/examples/react/basic) examples!
23​
24### CDN
25​
26If 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:
27​
28```html
29<script src="https://unpkg.com/@tanstack/react-query@4/build/umd/index.production.js"></script>
30```
31​
32Once you've added this you will have access to the `window.ReactQuery` object and its exports.
33​
34> This installation/usage requires the [React CDN script bundles](https://reactjs.org/docs/cdn-links.html) to be on the page as well.
35​
36### Requirements
37​
38React Query is optimized for modern browsers. It is compatible with the following browsers config
39​
40```
41Chrome >= 73
42Firefox >= 78
43Edge >= 79
44Safari >= 12.0
45iOS >= 12.0
46opera >= 53
47```
48​
49> 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.