setState happens asynchronously... Therefore you need to use previous state first to ensure you are using the latest if you are going to calculate the state based on previous state.
Yes this is it
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.