how to update nested object values 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 });
}