Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: updating state by spreading in latest state values, not stale ones
The situation here is that the `setAnimate` is being called in a setTimeout callback. By the time the callback has been called, the state may have been changed. But, the way this was written previous to this commit is that it would spread in the old values of state. Instead of doing that, we should use the callback method for setState(), which takes the very latest state as it's first argument, and we spread that here instead.
- Loading branch information