update value of property inside nested object javascript code example
Example: updating nested attributes js
onChange(e) {
const { user } = { ...this.state };
const currentState = user;
const { name, value } = e.target;
currentState[name] = value;
this.setState({ user: currentState });
}