DEV Community

Matt C
Matt C

Posted on

🚀 fetchff 4.0.0 is officially released! (Jul 14, 2025)

🚀 fetchff v4.0.0 is out now!
A faster, smarter, and more customizable fetch experience for modern web and mobile apps.

After months of refinement, fetchff 4.0.0 is here — focused on performance, type safety, and developer ergonomics.

The most important thing in the plugin is raw speed.

Benchmark fetchff faster than SWR and React Query

Faster alternative to SWR and React Query

✨ Key New Features

🎣 React Hook: useFetcher(url, config)
Now you can fetch data in React with built-in loading, caching, and revalidation—import it from fetchff/react.

Stale-While-Revalidate (SWR)
Use the new staleTime option to serve cached data immediately while seamlessly re-fetching in the background.

Custom Cache Keys & Infinite Cache
Define unique cache key logic or enable permanent caching for long-lived data.

Auto Refetch on Focus & Reconnect
New refetchOnFocus and refetchOnReconnect settings ensure your data stays fresh as users return or regain connectivity.

Interceptors Enhancements
Added:
onRetry(response, attempt) – for custom retry logic
onAbort(response) – to handle abort scenarios gracefully

Flexible Error & Data Handling
cacheErrors: optionally preserve failed responses in cache
keepPreviousData: display stale data until new fetch completes
select(data): custom data transformation hook before UI consumption

Adaptive Timeout & Abort Support
Timeouts now adapt to connection speed

Improved Request Handling
Automatically sets Content-Type headers based on request body type—no more manual JSON-only handling
Auto-generated cache keys now omit low-impact headers (cache, mode, integrity…) for cleaner cache behavior.

Why this matters?

fetchff continues to deliver a compact, zero-runtime‑dependency fetch library (≈ 5 KB gzipped) with first‑class TypeScript support, now featuring seamless React hooks, advanced caching strategies, and powerful customization options—all while staying light and intuitive.

📦 Upgrading is simple: npm install fetchff@4
📖 Full docs & examples: check the React Integration and cache settings in the README on Github.

For the list of all changes, see full changelog.

Top comments (0)