I am a bit new to react/redux
From what I understand state is to be immutable in redux, but when searching for component binding examples I keep seeing things such as
<TextField
id="usernameId"
value={this.state.username}
onChange={this.handleUsernameChange}
/>
public handleUsernameChange = (event: any) => {
this.setState({
username: event.target.value
});
}
To my understanding this is mutating State. When I change the binding to use a global instead. In the callbacks the values are being changed and updated, however the UI is not observing these variables.
I guess this question is just a sanity check. Is this acceptable in redux?
Please note I am not using other libraries at the moment
Code I've tried without using state
let loginInfomation: ILoginInformation = new LoginInformation;
...
<TextField
id="usernameId"
value={this.loginInformation.username}
onChange={this.handleUsernameChange}
/>
public handleUsernameChange = (event: any) => {
this.loginInfomation.username = event.target.value
});
}