-
this.setState({ abc.xyz: 'new value' });
syntax is not allowed.
You have to pass the whole object.this.setState({abc: {xyz: 'new value'}});
If you have other variables in abc
var abc = this.state.abc; abc.xyz = 'new value'; this.setState({abc: abc});
-
You can have ordinary variables, if they don’t rely on this.props and
this.state
.