You can install Preact Query via NPM, or a good ol' <script> via ESM.sh.
npm i @tanstack/preact-querynpm i @tanstack/preact-queryor
pnpm add @tanstack/preact-querypnpm add @tanstack/preact-queryor
yarn add @tanstack/preact-queryyarn add @tanstack/preact-queryor
bun add @tanstack/preact-querybun add @tanstack/preact-queryWanna give it a spin before you download? Try out the simple example
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 { render } from 'https://esm.sh/preact@10.23.1'
import { QueryClient } from 'https://esm.sh/@tanstack/preact-query'
</script><script type="module">
import { render } from 'https://esm.sh/preact@10.23.1'
import { QueryClient } from 'https://esm.sh/@tanstack/preact-query'
</script>Preact Query is optimized for modern browsers. It is compatible with the following browsers config
Chrome >= 91
Firefox >= 90
Edge >= 91
Safari >= 15
iOS >= 15
Opera >= 77Chrome >= 91
Firefox >= 90
Edge >= 91
Safari >= 15
iOS >= 15
Opera >= 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_modules yourselves.
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-querynpm i -D @tanstack/eslint-plugin-queryor
pnpm add -D @tanstack/eslint-plugin-querypnpm add -D @tanstack/eslint-plugin-queryor
yarn add -D @tanstack/eslint-plugin-queryyarn add -D @tanstack/eslint-plugin-queryor
bun add -D @tanstack/eslint-plugin-querybun add -D @tanstack/eslint-plugin-query