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.
| Feature | @lacspace/query | SWR |
|---|---|---|
| Dependencies | ·Zero | Zero (peer: React) |
| useQuery / useMutation | ·Yes | Yes (useSWR / useSWRMutation) |
| Shared cache & dedup | ·Yes | Yes |
| Part of one ecosystem | Yes — pairs with @lacspace/store, hooks, api | Standalone |
| SSR-safe | ·Yes | Yes |
| Bundle size | ·Tiny | Small |
| TypeScript-first | ·Yes | Yes |
| Licence | ·Lacspace Free Licence (MIT-equivalent) | MIT |
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.
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.
No. Like every @lacspace package it is zero-dependency and isomorphic; React is a peer.