Function createMutation

  • Create mutation

    const { mutateAsync, isLoading } = createMutation(async (values) => {
    // ...fetch data
    });

    Description

    https://yonathan06.github.io/solid-cached-resource/modules.html#createMutation

    Type Parameters

    • T = unknown

    • R = unknown

    Parameters

    • fn: ((args: T) => Promise<R>)
        • (args: T): Promise<R>
        • Parameters

          • args: T

          Returns Promise<R>

    • Optional options: CreateMutationOptions<R>

      optional object with the onSuccess hook

    Returns { error: Accessor<unknown>; isError: (() => boolean); isLoading: Accessor<boolean>; isSuccess: Accessor<boolean>; mutateAsync: ((args: T) => Promise<R>); reset: (() => void); returnedData: Accessor<undefined | R> }

    • error: Accessor<unknown>
    • isError: (() => boolean)
        • (): boolean
        • Returns boolean

    • isLoading: Accessor<boolean>
    • isSuccess: Accessor<boolean>
    • mutateAsync: ((args: T) => Promise<R>)
        • (args: T): Promise<R>
        • Parameters

          • args: T

          Returns Promise<R>

    • reset: (() => void)
        • (): void
        • Returns void

    • returnedData: Accessor<undefined | R>

Generated using TypeDoc