intermediate
Validation
Coordinate client feedback, server validation, schema parsing, accessibility, and trusted boundaries.
Validation spans HTML constraints (`required`, `pattern`), client schemas for fast feedback, and authoritative server checks. Never trust client-only validation for security. Show errors next to fields with `aria-invalid` and `aria-describedby` linking helper text.
Validate on blur, submit, or change depending on UX — aggressive onChange validation can annoy users. Parse with a schema library at boundaries so invalid data never reaches business logic silently.
On interviews, explain the concept with a concrete example and name the behavior interviewers probe.
Common pitfalls include hiding data flow, over-splitting components, and putting side effects in render.
The trade-off is often clarity versus reuse or explicit props versus convenience.
Checklist:
- Server remains source of truth.
- Accessible error association per field.
- Schema parse at form boundary.