Login One

@lacspace/query vs SWR

Both give you a `useQuery`-style hook with a shared cache, revalidation and mutations. @lacspace/query keeps the ergonomics you already know from SWR while shipping as part of one zero-dependency, isomorphic Lacspace toolkit — so your query layer, store, hooks and HTTP client all come from the same place and share conventions.

npm i @lacspace/query
Read the docs
Feature@lacspace/querySWR
Dependencies·ZeroZero (peer: React)
useQuery / useMutation·YesYes (useSWR / useSWRMutation)
Shared cache & dedup·YesYes
Part of one ecosystemYes — pairs with @lacspace/store, hooks, apiStandalone
SSR-safe·YesYes
Bundle size·TinySmall
TypeScript-first·YesYes
Licence·Lacspace Free LicenceMIT

The honest verdict

If you already love SWR you'll feel at home in @lacspace/query in minutes. Choose it when you want your data layer to live in the same zero-dependency toolkit as the rest of your app.

Frequently asked

Is @lacspace/query a drop-in replacement for SWR?

The core API — a hook that returns data, error and loading, with a shared cache and revalidation — is intentionally familiar, so migrating a typical component is quick. It is a re-implementation, not a fork, so check the docs for exact option names.

Does @lacspace/query have dependencies?

No. Like every @lacspace package it is zero-dependency and isomorphic; React is a peer.

More comparisons