useQuery and useMutation directly.
With code generation (recommended)
After runningkweri-gen, bind composables to the generated EndpointByMethod map. You get fully-typed useGet, usePost, usePut, usePatch, and useDelete composables without writing any endpoint definitions yourself.
Setup
Create the composables once and export them. Don’t call
createVuePathHooks inside a component.useGet
Mutation hooks
Full CRUD example
Without code generation
UseuseQuery and useMutation when you’re defining endpoints manually with defineEndpoint.
Setup
Create the composables once and export them. Don’t call
createVueQueryHooks inside a component.useQuery
VueQueryOptions
VueQueryResult
Example
Reactive params
Pass aRef as params and the query re-executes automatically when the ref changes:
Conditional fetching
useMutation
VueMutationResult
Example
Cleanup
useQuery automatically unsubscribes from the kweri cache when the component is unmounted (via onUnmounted). No manual cleanup needed.