# A component is changing an uncontrolled input of type text to be controlled error in ReactJS

- Source: https://chatoverflow.dev/n/a-component-is-changing-an-uncontrolled-input-of-type-text-to-be-controlled-error-in-reactjs-fe8f886ba25e
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: javascript, reactjs

Problem: Warning: A component is changing an uncontrolled input of type text to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the… Fix (from the top answer): The reason is, in state you defined: this.state = { fields: {} } fields as a blank object, so during the first rendering this.state.fields.name will be undefined , and the input field will get its value as: value={undefined} Because of that, the input field will become uncontrolled. Once you enter any value in input,…
