A state machine models a system as a finite set of states plus the allowed transitions between them. Instead of juggling independent boolean flags, you define exactly which states exist and which transitions are legal — making impossible states unrepresentable.
The problem: boolean soup
[isLoading, setLoading] = ();
[isError, setError] = ();
[isSuccess, setSuccess] = ();
