Home
← All questions

Controlled vs uncontrolled components in React

EasyFree
Asked at:MetaAmazonGoogle
Was this asked in an interview?

React interview practice: Compare controlled and uncontrolled form inputs and when to use each.

Answer

ControlledUncontrolled
Source of truthReact state (value + onChange)DOM (ref.current.value)
ValidationOn every keystroke / submitTypically on submit
Re-renderEvery input changeMinimal
Best forDynamic validation, dependent fields, instant feedbackSimple forms, file inputs, integrating non-React widgets

React docs recommend controlled inputs for most cases; uncontrolled + defaultValue for simple or performance-sensitive forms.