To fix ‘a component is changing an uncontrolled input to be controlled. This is likely caused by the value changing from undefined to a defined value, which should not happen. Decide between using a controlled or uncontrolled input element for the lifetime of the component.’ error with React, we should make sure the value prop of the input is always set to a value.
For instance, we write
<input value={inputValue} />
to add an input with the value prop set to the inputValue state or prop.
We should make sure inputValue is never null or undefined to avoid this error.