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.
Type Parameters
Section titled “Type Parameters”Req
Res
Context
Section titled “Context”Context = unknown
Parameters
Section titled “Parameters”endpoint
Section titled “endpoint”ApiEndpoint<Req, Res>
Endpoint contract to execute for each mutation.
options?
Section titled “options?”UseEndpointMutationOptions<Req, Res, Context> = {}
Cache invalidation and lifecycle callbacks for the mutation.
Returns
Section titled “Returns”UseEndpointMutationResult<Req, Res>
Mutation state plus mutate, mutateAsync, and reset helpers.
Example
Section titled “Example”const mutation = useEndpointMutation(saveEndpoint, { invalidate: [{ endpoint: listEndpoint }],});