Skip to content

useEndpointMutation

useEndpointMutation<Req, Res, Context>(endpoint, options?): UseEndpointMutationResult<Req, Res>

Defined in: wp-typia-rest/src/react-mutation.ts:29

Execute a non-GET endpoint contract and keep mutation state in React state.

Req

Res

Context = unknown

ApiEndpoint<Req, Res>

Endpoint contract to execute for each mutation.

UseEndpointMutationOptions<Req, Res, Context> = {}

Cache invalidation and lifecycle callbacks for the mutation.

UseEndpointMutationResult<Req, Res>

Mutation state plus mutate, mutateAsync, and reset helpers.

const mutation = useEndpointMutation(saveEndpoint, {
invalidate: [{ endpoint: listEndpoint }],
});