update state when a value changes in react js code example
Example: update state in react
You have to use setState() for updating state in React
{
hasBeenClicked: false,
currentTheme: 'blue',
}
setState({
hasBeenClicked: true
});
You have to use setState() for updating state in React
{
hasBeenClicked: false,
currentTheme: 'blue',
}
setState({
hasBeenClicked: true
});