A pragmatic native fetch API wrapper for JavaScript.
npm install @z-fetch/fetch
import { GET } from '@z-fetch/fetch';
async function getPosts() {
const { data, error } = await GET('https://jsonplaceholder.typicode.com/posts');
if (data) {
console.log('Posts:', data);
} else {
console.error('Error fetching posts:', error);
}
}
getPosts();
Built on the native fetch API with no extra libraries needed.
Works with any JavaScript project, no matter the framework.
Automatically caches responses with auto revalidation for optimized performance.
Automatically parses JSON responses with minimal boilerplate.
Supports configurable request retries and polling mechanisms.
Has builtin helpers for most common use cases.
Cancel requests on demand with built‑in cancellation support.
Supports OPTIONS, TRACE, HEAD, and custom HTTP verbs without extra setup.
You can use hooks to intercept and transform requests and responses.