3.
How can you update the state in React?
By creating a new instance of the state object.
By directly modifying the state object.
By using the setState method.
React does not allow state updates.
Correct: C
In React, we should always update the state using the setState method. This is because React needs to be aware of the state change in order to efficiently update the component and trigger a rerender. Modifying the state directly or creating a new instance of the state object will not trigger a rerender and can lead to unexpected behavior in the application. The setState method ensures that React is properly notified of the state change and can update the component accordingly.