An open API service indexing awesome lists of open source software.

https://github.com/devforgetech/fetch-hooks-core

Universal React-style hooks for fetch() — works in Node, Bun, Deno, Cloudflare Workers, and edge runtimes. Tiny, dependency-free, TypeScript-first.
https://github.com/devforgetech/fetch-hooks-core

bun cloudflare-workers deno edge-runtime fetch hooks http javascript nodejs npm-library opensource request signals typescript

Last synced: 5 months ago
JSON representation

Universal React-style hooks for fetch() — works in Node, Bun, Deno, Cloudflare Workers, and edge runtimes. Tiny, dependency-free, TypeScript-first.

Awesome Lists containing this project

README

          

# fetch-hooks-core



The Modern Fetch Utility Library for JavaScript — Tiny, Typed, Universal


Designed for developers building Node servers, Bun scripts,
Deno apps, Cloudflare Workers, and Edge runtimes.

---

# 🚀 Introduction

`fetch-hooks-core` brings the ergonomics of React hooks to any JavaScript environment — no framework required.
If you use `fetch()` often, this library gives you **reactive data**, **retry logic**, **polling**, and **concurrency tools** that feel instantly familiar.

### SEO Keywords:

fetch hooks, TypeScript fetch library, universal fetch utilities, Node fetch wrapper, Bun fetch, Deno fetch, fetch concurrency, fetch retry

---

# ✨ Feature Matrix

| Feature | fetch-hooks-core | Ky | Axios |
| ------------------------------ | ---------------- | ---------- | --------- |
| Universal runtime support | ✅ | ❌ | ❌ |
| Hook-style API | ✅ | ❌ | ❌ |
| Zero dependencies | ✅ | ❌ | ❌ |
| Concurrency control | ✅ | ❌ | ❌ |
| Polling helper | ✅ | ❌ | ❌ |
| Retry with exponential backoff | ✅ | ⚠️ limited | ⚠️ plugin |
| TypeScript-first | ✅ | ⚠️ | ⚠️ |

---

# 📦 Installation

```bash
npm install fetch-hooks-core
```

---

# 🧭 Quick Example

```ts
import { useFetch } from 'fetch-hooks-core';

const { data, loading, error } = await useFetch('https://example.com');
```

---

# 🧠 API Documentation

## useFetch()

Reactive data wrapper for fetch.

## useRetry()

Retries any async function automatically.

## usePoll()

Polling with auto-stop.

## useConcurrent()

Parallel queue processor.

---

# 🛠️ Advanced Example (Premium)

```ts
import { useFetch, useRetry, useConcurrent } from 'fetch-hooks-core';

const api = await useFetch('https://api.example.com/data');
const retryFetch = useRetry(() => fetch('https://api.com/retry'), { retries: 5 });
const { results } = await useConcurrent([() => fetch('/a'), () => fetch('/b')], { concurrency: 2 });
```

---

# ❤️ Community

If you find this useful, star the repo and share it.

# 📎 Links

GitHub: https://github.com/devforgetech/fetch-hooks-core
npm: https://npmjs.com/package/fetch-hooks-core