A form usually has three different kinds of state: editable values, validation feedback and submission status. Combining them into unrelated flags makes it easy to display contradictory states.
Implementation approach
Keep editable values local unless multiple routes truly need them. Model pending and failure states explicitly, and derive values such as whether submission is allowed instead of storing a second copy.
Example
type SubmitState =
| { status: 'idle' }
| { status: 'pending' }
| { status: 'error'; message: string };
Validation and edge cases
Try submitting twice, losing the network connection and receiving field errors from the server. Preserve entered values when submission fails, and ensure errors are associated with their inputs.
Key takeaway
Introduce a form library when repeated validation and dynamic field requirements justify it, not simply because a form exists.




