I have a react component that I have created. In this component, I call a function that updates the state generically:
updateCheckbox: function(name, value) {
this.setState({name: value});
},
I have checked the value of this function and I see that the correct value is getting called and set. The render function is then called, because the state has just been set. When I go inside the render function, the state has not been updated.
I realized this is because I have updated the state generically. If I put the actual name of the state in the setState function, then everything is updated as it should.
Does anyone know a workaround for this?