Skip to content

Migrating from react-grabkit

The react-grabkit npm package is deprecated and no longer maintained. Grabkit is a focused HTTP client; React hooks and providers are intentionally out of scope.

Before (react-grabkit)After (grabkit)
Hooks such as useGrabYour data layer (TanStack Query, SWR, Relay, etc.)
Provider / contextFactory per API origin: const grab = grabkit(baseURL)
Framework-coupled errorsTuple [data, error, meta] + if (error)
  1. Remove react-grabkit from dependencies.
  2. Install grabkit.
  3. Create a grab callable where you previously configured the provider:
import grabkit from 'grabkit';
export const grab = grabkit(process.env.API_URL!, {
casing: 'camelCase',
});
  1. Call grab inside your existing query/mutation functions. Use orThrow when the data layer expects thrown errors:
import grabkit, { orThrow } from 'grabkit';
const grab = grabkit(process.env.API_URL!);
async function fetchUser(id: string) {
const [data] = await orThrow(grab(`GET /users/${id}`));
return data;
}

Grabkit still returns errors in the tuple by default; orThrow is optional sugar for throw-based caches. See Errors & results.

Full walkthroughs:

grabkit 1.0.0 defaults to JSON:API. If your API is plain JSON, set format: 'json' on the factory. See Plain JSON.