Apollo-style mutation hook — idle until mutate() is called. Returns { data, loading, error, mutate, reset, cancel, called }.
mutate()
{ data, loading, error, mutate, reset, cancel, called }
mutate() returns a Promise that resolves with the parsed response body.
const { mutate, loading, error } = useMutation<User>(api, 'post', '/users', { emitOnSuccess: 'users.created', }, observer); const user = await mutate({ name: 'Alice' });
FetchEngine instance
HTTP method (post, put, delete, patch)
Request path
Optional
Mutation options (defaults, emitOnSuccess)
Optional ObserverEngine for emitOnSuccess
Apollo-style mutation hook — idle until
mutate()is called. Returns{ data, loading, error, mutate, reset, cancel, called }.mutate()returns a Promise that resolves with the parsed response body.