UNPKG

next-safe-action

Version:

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

25 lines (22 loc) 1.08 kB
import { c as HookSafeStateActionFn, a as HookCallbacks, f as UseStateActionHookReturn, } from "./hooks.types-RxW9RXw1.mjs"; import { S as StandardSchemaV1 } from "./index.types-CJ06jFQp.mjs"; /** * 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>; export { useStateAction };