How to update state in class component code example
Example 1: update state in react
You have to use setState() for updating state in React
{
hasBeenClicked: false,
currentTheme: 'blue',
}
setState({
hasBeenClicked: true
});
Example 2: reactjs update state example
{
hasBeenClicked: false,
currentTheme: 'blue',
}
Example 3: reactjs update state example
{
hasBeenClicked: false,
currentTheme: 'bluesss',
}s