0
Challenge · 67Architecture & State

Form Validation

Coreused in ~80% of apps

A form that submits garbage is a backend bug waiting to happen and a frustrated user staring at a vague error. Validation is the difference between a form that guides people to success and one that punishes them. The hard part isn't the rules — it's WHEN you show them.

Core idea. Validation = run rules over field values, derive an error message per field, and decide WHEN to surface it (as they type, when they leave a field, or when they submit). Client-side validation is purely UX; the server must validate again because anything in the browser can be bypassed.
Playground, this isn't a screenshot
VALIDATION TIMING
type
quiet
blur
quiet
submit
validates
Pick a timing mode, then type a bad email and watch WHEN the error appears.

Same field, three feels: onChange nags as you type, onBlur waits until you leave, onSubmit stays quiet until you try. Submit always checks everything.

↑ play a little first, then dig in