I already know how to setState with a dynamic key name but how do I set a value as the state with a dynamic key?
Example
function thing(key) {
let stuff = this.state.key;
//Do stuff
}
I already know how to setState with a dynamic key name but how do I set a value as the state with a dynamic key?
Example
function thing(key) {
let stuff = this.state.key;
//Do stuff
}
Didn't even think of think of this as first but all I did was
function thing(key) {
let stuff = this.state[key];
//Do stuff
}
and it worked!