For a plugin I'm using I have to have a state that looks like this:
getInitialState() {
return {
invalid: true,
access: {
access_code: '',
zipcode: '',
password: '',
confirm: '',
hospital_id: '',
},
}
},
How would I set the state of hospital_id without setting the rest of access?
This seems to remove everything but hospital_id:
this.setState({access: {hospital_id: 1}})
question from:
https://stackoverflow.com/questions/34956479/how-do-i-setstate-for-nested-object 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…