In React-land, this is a pretty common problem: You have two useState variables, and when something happens, both variables must change, at once.
The key problem here being the “at once” part. You see, in React all state is asynchronous, so if we simply do:
setState1(true)
setState2(false)
We have no warrantee that state 2 is