0

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 component.*

Following is my code:
constructor(props) {
super(props);
this.state = {
fields: {},
errors: {}
}
this.onSubmit = this.onSubmit.bind(this);
}

….

onChange(field, e){
let fields = this.state.fields;
fields[field] = e.target.value;
this.setState({fields});
}

….

render() {
return(


{this.state.errors[“name”]}

)
}

Kuldeep Baberwal Changed status to publish January 28, 2025