Can we directly update state in React?

One should never update the state directly because of the following reasons: If you update it directly, calling the setState() afterward may just replace the update you made. When you directly update the state, it does not change this.

Sizin İçin Seçtik  How do you create a global state?

Leave a Reply

Your email address will not be published. Required fields are marked *