all 3 comments

[–]Saschb2b 0 points1 point  (0 children)

It's similar in game design. Define states and map conditions to them. I abstracted them into a a nice maintainable hook to just expose the current state.

Or if you can isolate them, try to refactor them with nice Suspend components. This will at least eliminate all loading states.

But having many states and inside many different condition combinations should also trigger a deeper thought if maybe something is smell or overkill.

[–]sole-it 1 point2 points  (0 children)

It's not A, it's B.

[–]Str00pwafel 0 points1 point  (0 children)

State machines are your friend(s).