# @gluedigital/ruse-fetch-extras

> Extra utilities for ruse-fetch

Latest version **1.2.10** (published 2024-06-26) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install @gluedigital/ruse-fetch-extras
pnpm add @gluedigital/ruse-fetch-extras
yarn add @gluedigital/ruse-fetch-extras
bun add @gluedigital/ruse-fetch-extras
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.10 |
| Published | 2024-06-26 |
| First published | 2021-08-20 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 20.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Glue Digital |
| Keywords | react, react-hooks, fetch, redux, suspense, isomorphic, ssr |

## Links

- npm: https://www.npmjs.com/package/@gluedigital/ruse-fetch-extras
- npm.io page: https://npm.io/package/@gluedigital/ruse-fetch-extras

## 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

- 1.2.10 (latest) — 2024-06-26
- 2.0.1 (next) — 2024-12-17
- 2.0.0 — 2024-12-10
- 1.2.9 — 2024-06-21
- 1.2.8 — 2024-05-16
- 1.2.7 — 2023-02-27
- 1.2.6 — 2022-02-08
- 1.2.5 — 2022-01-03
- 1.2.4 — 2021-12-21
- 1.2.3 — 2021-12-21
- 1.2.2 — 2021-12-21
- 1.2.1 — 2021-12-21
- 1.2.0 — 2021-12-08
- 1.1.1 — 2021-11-29
- 1.1.0 — 2021-11-25
- … 3 more at https://npm.io/package/@gluedigital/ruse-fetch-extras/versions

## README

# ruse-fetch-extras

Extra utilities for [ruse-fetch](https://www.npmjs.com/package/ruse-fetch).

## API

### `useFetch` / `useFetchCb`

These methods are similar to the ones from `ruse-fetch`, but they add:

  - Support for JSON bodies: set `body` to an object, and it will serialize it, and set the content-type
  - Support for GET params: set `params` to an object, and it will be converted to a query string and added to the url
  - Auto-add the user token from the store: just save it at `store.user.token`

### `useFetchUncachedCb`

Similar to `useFetchCb`, but does not dispatch anything. This is similar to calling plain fetch, but with all the additions above.

### `usePaginatedFetch`

This hook helps deal with "infinite scroll" use cases. It works like `useFetch`, but returns an object with the following fields:

  - `data`: The aggregated results from the pages loaded so far
  - `page`: The last page loaded
  - `isLoadingMore`: Indicates if we are loading a new page
  - `hasNext`: Indicates if there are more pages to load
  - `loadMore`: Function to load the next page of results

The behaviour for concatenating pages and detecting the last page can be customised with the `merger` and `hasNext` options

### `useCRUD`

Provides CRUD methods for an entity. It assumes the standard REST URLs for each method.

### `usePeriodicFetch`

Similar to `useFetch`, but updates the data automatically with the specified period.

Please note that this method does not de-duplicate calls with the same URL.

---
_Source: https://npm.io/package/@gluedigital/ruse-fetch-extras · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
