I'm using ReactJS and I need to change the status of the values but the value property is in the state in this way:
this.state = {
form:{
name:{
value:''
}
}
}
I tried it in different ways on the form like:
<TextInput
name='form.name.value'
value={this.state.form.name.value}
onChange={value => this.onChange('name', value)}
/>
onChange = (e) => {
this.setState({ [e.target.name]: e.target.value})
}
But never changes the value on state.
How can I do this? thanks!!!!!!
TextInputis itreact-nativeorreactjs? Ifreactjsand custominputfield then show code ofTextInput. Elsereactjsinput means HTML does not provide value directly inonChange<div className="input-field"> <i className="material-icons prefix">{icon}</i> <input name={name} value={value} onChange={onChange} label={label} type={type} /> </div>