Getting current state value from setState function in React
Today I learned, I knew this before but today saw it in a practical example. In our react setState function we can get the prevState and return the new state within the same function which I think is very helpful. code snippet for setState