This can cause unforeseen behavior inside your application Should the code earlier mentioned known as many periods in precisely the same update cycle. To prevent this you'll be able to go an updater callback purpose to setState as an alternative to an object. W3Schools is optimized for learning and schooling. https://sethnnlhd.verybigblog.com/12567530/the-smart-trick-of-react-front-that-no-one-is-discussing