Interface Props<TRequestSchema, TResponseSchema>

Props for withMutation method.

interface Props<TRequestSchema, TResponseSchema> {
    key: MutationKey;
    schema: {
        request: TRequestSchema;
        response: TResponseSchema;
    };
    useCallback(): ((request) => Promise<TypeOf<TResponseSchema>>);
    invalidator?: ((props) => Promise<unknown>);
    defaultOptions?: Options<TRequestSchema, TResponseSchema>;
}

Type Parameters

  • TRequestSchema extends RequestSchema

    Request schema.

  • TResponseSchema extends ResponseSchema

    Response schema.

Methods

Properties

key: MutationKey

Query key used to cache the result.

schema: {
    request: TRequestSchema;
    response: TResponseSchema;
}

Mutation schemas.

Type declaration

invalidator?: ((props) => Promise<unknown>)

Callback used to invalidate the query cache.

Type declaration

    • (props): Promise<unknown>
    • Parameters

      • props: Props

      Returns Promise<unknown>

defaultOptions?: Options<TRequestSchema, TResponseSchema>

Default options for the mutation.