Actions and modern forms

useActionState

Returns the latest action result, dispatcher and pending flag; the action receives previous state before its payload.

Formal Syntax & Structure

react syntaxreact
const [result, dispatch, pending] = useActionState(action, initialState)

Working Example

Example Snippetreact
const [result, dispatch, pending] = useActionState(action, initialState)
React Reference