Problem Statement
How do you update state in a class component using setState()?
Explanation
setState() is used to update a class component’s state. It merges the new values with the existing state and triggers a re-render.
Code Solution
SolutionRead Only
this.setState({ count: this.state.count + 1 });