React · Middle · Question 29 of 75

What does useActionState give you in React 19?

Explanation

const [state, formAction, isPending] = useActionState(action, initialState). The action function receives the previous state and FormData, and its result becomes the new state - handy for validation errors. formAction is passed to <form action>. It works with Server Functions too.

Further reading

Problem with a question

React · Middle · question 29

Test yourself

Take the React · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz