I found mutating the state can be very tricky and can possibly introduce a lot of problems. In this article, I am going to talk about the fundamental things you need to know about
setState(). This includes some properties of
setState() and detailed explanations about
setState() in different lifecycles.
Let’s begin our journey and start with something easy.
To better understand what
setState() does, let’s first take a look at what the state of a React component is.
The state allows React components to change their output over time in response to user actions, network responses, etc, without violating their…