UNPKG

next-safe-action

Version:

Type safe and validated Server Actions in your Next.js project.

27 lines (25 loc) 1.17 kB
import { M as StandardSchemaV1 } from "./index.types-CqcWrJ4z.mjs"; import { d as UseStateActionHookReturn, i as HookSafeStateActionFn, n as HookCallbacks, } from "./hooks.types-BWkq1TFG.mjs"; //#region src/stateful-hooks.d.ts /** * Use the stateful action from a Client Component via hook. Used for actions defined with [`stateAction`](https://next-safe-action.dev/docs/define-actions/instance-methods#action--stateaction). * @param safeActionFn The action function * @param utils Optional `initResult`, `permalink` and callbacks * @deprecated Directly use `useActionState` hook from `react` instead. * * {@link https://next-safe-action.dev/docs/execute-actions/hooks/usestateaction See docs for more information} */ declare const useStateAction: <ServerError, S extends StandardSchemaV1 | undefined, CVE, Data>( safeActionFn: HookSafeStateActionFn<ServerError, S, CVE, Data>, utils?: { initResult?: Awaited<ReturnType<typeof safeActionFn>>; permalink?: string; } & HookCallbacks<ServerError, S, CVE, Data> ) => UseStateActionHookReturn<ServerError, S, CVE, Data>; //#endregion export { useStateAction }; //# sourceMappingURL=stateful-hooks.d.mts.map