Installation
Setup
Wrap your application withQueryClientProvider:
Core Primitives
useQuery (formerly createQuery)
Fetch and cache data with theuseQuery primitive:
The hook was renamed from
createQuery to useQuery in v5. Both names are exported for backward compatibility, but useQuery is now preferred.Reactive Query Keys
Solid Query works seamlessly with Solid’s reactive primitives:useMutation (formerly createMutation)
Perform side effects with mutations:useInfiniteQuery (formerly createInfiniteQuery)
Implement infinite scrolling:Solid’s Reactivity System
Fine-Grained Reactivity
Solid Query leverages Solid’s fine-grained reactivity for optimal performance:Reconciliation
Solid Query includes areconcile option for efficient data updates:
The
reconcile option is Solid-specific and replaces React Query’s structuralSharing. It provides better performance for Solid’s reactivity system.Advanced Patterns
useQueries (formerly createQueries)
Execute multiple queries in parallel:Query Options Factory
useIsFetching
Show a global loading indicator:useMutationState
Track all mutations:TypeScript
Full TypeScript support with type inference:SSR Support
Solid Query works with SolidStart for server-side rendering:Migration from v4
The primitive names have changed in v5:- v5 (Current)
- v4 (Legacy)
Both naming conventions are exported for backward compatibility, but the
use* prefix is now preferred to align with other frameworks.