# remix-query

> Query for Remix-Run

Latest version **0.2.0** (published 2022-01-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install remix-query
pnpm add remix-query
yarn add remix-query
bun add remix-query
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2022-01-19 |
| First published | 2022-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 76 |
| Author | Siddhant Gupta |
| Maintainers | guptasiddhant |
| Keywords | remix-run, remix, react, query, api |

## Links

- npm: https://www.npmjs.com/package/remix-query
- Repository: https://github.com/guptasiddhant/remix-query
- Homepage: https://github.com/guptasiddhant/remix-query#readme
- Issues: https://github.com/guptasiddhant/remix-query/issues
- npm.io page: https://npm.io/package/remix-query

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2022-01-19
- 0.1.1 — 2022-01-14
- 0.1.0 — 2022-01-14
- 0.0.0 — 2022-01-14

## README

# remix-query

Keep your loader data in sync in your component without reloading the page.

## useQuery

The hook to keep loader data of any (current or other) route in-sync at client-side without reloading the page. ([View source](./src/useQuery.ts))

- Reload when window is visible (default: true)
- Reload when internet re-connects (default: true)
- Reload when window receives focus (default: false)

```tsx
import { useQuery } from "remix-query";
```

- Default

  ```tsx
  const { data, loading, reload } = useQuery<DataType>();
  ```

- Polling

  ```tsx
  const { data, loading } = useQuery<DataType>({ reloadInterval: 5000 });
  ```

- Other route

  ```tsx
  const { data, loading, reload } = useQuery<DataType>({
    route: "/other/path",
  });
  ```

- Other options

  ```tsx
  const { data, loading, reload } = useQuery<DataType>({
    reloadOnWindowVisible: true
    reloadOnWindowFocus: true
    reloadOnReconnect: true
  });
  ```

---
_Source: https://npm.io/package/remix-query · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
