Why we use state in React instead of variable?

Though using state may seem similar to class variable but state is a protected keyword in React that refers to stored component data . The major difference between using class variables and state is updating data. Instead of manually reassigning the variable, you call this. setState() .

Sizin İçin Seçtik  What happens when we dispatch an action react?

Leave a Reply

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