Form feedback
After this film you canshow pending and validation errors on a form with useActionState.
Exercise
Download the exercise (a zip). Unzip it, read exercise.md, then in exercise/ run npm install and node check.mjs. The checker runs a real build and says PASS or FAIL for each criterion.
Recall
Answer each one out loud before you open it.
What does useActionState give Carol's form?
What the Server Function last returned (the message), an action for the form, and pending, true while it runs.
Why did 450 vanish when the error appeared, and how did Carol keep it?
React empties the form after every action that returns, even with an error. Her function returned the price, and the field uses it as its defaultValue.
Why does the login form's message never carry the passcode back?
Whatever the function returns goes to the browser. Return only what is safe to show.