useQuery and useMutation directly.
With code generation (recommended)
After runningkweri-gen, bind hooks to the generated EndpointByMethod map. You get fully-typed useGet, usePost, usePut, usePatch, and useDelete hooks without writing any endpoint definitions yourself.
Setup
Create the hook factory once and export it. Don’t call
createReactPathHooks inside a component.Passing
useSyncExternalStore on its own still works. Adding useRef gives each
mutation hook call its own status; without it, components mutating the same
endpoint share one status.useGet
Mutation hooks
Full CRUD example
Without code generation
UseuseQuery and useMutation when you’re defining endpoints manually with defineEndpoint.
Setup
Create the hooks once and export them. Don’t call
createReactQueryHooks inside a component.