UNPKG

next-form-action

Version:

A TypeScript library for handling server actions in Next.js with type-safe error handling and callbacks

15 lines 503 B
import { Action, ActionState } from "@/types"; export interface UseActionOptions { onSuccess?: (state: ActionState & { success: true; }) => void | Promise<void>; onError?: (state: ActionState & { success: false; }) => void | Promise<void>; } export declare function useAction<T = unknown>(action: Action<T>, options?: UseActionOptions): { dispatch: (data?: T) => void; state: ActionState | undefined; isPending: boolean; }; //# sourceMappingURL=index.d.ts.map