Q. What is the correct way to update state based on the previous state?
β
Correct Answer: (B)
setState(prevState => newState)
Explanation: Using a function with prevState ensures you update based on the latest state.