One does not simply “setState”

If you have used ReactJS I bet you are familiar with “setState”. What if I told you, you cannot simply reliably set state using “setState”. Forgive the puns!

When I was learning React, upon my first encounter with setState, I thought “It’s like changing the value of a variable. This does one thing, changes the state, right?” Little did I know that there is deep sorcery behind the simple function.