useActionState exposes the action result, an action function, and a pending flag. Each submission can derive a new result from previous state and form data.
The demo moves through idle, pending, success, and error, updating both the button and message. Plan how to retain input and errors after failure.
When to use
Use it when a form should render submission progress and result together.