Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
Rambolus8431dMaybe your problem is that setstate is async and you are treating it as sync code? Try putting your sync code in the callback as a second argument to setstate
cb21973931d@Rambolus I know that it's async, also tried to put the sync code and the second setState as callback of the first setState, just like your suggestion. Still failed. Somehow achieved the expected behavior, but still there must be a better way than what I did. I can only imagine myself looking at my code in 1 year and asking myself "why did I write this HERE?"
This seems like more work than rxjs.