React — Interview Questions & Mental Models
Controlled vs uncontrolled inputs
- Controlled: React state is source of truth — use value + onChange.
- Uncontrolled: DOM holds value — use defaultValue + ref to read.
- When to use: forms needing instant validation / conditional UI → controlled; simple file inputs or non-React widget integrations → often uncontrolled + ref.