एक state machine एक सिस्टम को states के सीमित सेट के साथ मॉडल करता है साथ ही उनके बीच अनुमत transitions। स्वतंत्र boolean flags के साथ जूझने की जगह, आप बिल्कुल परिभाषित करते हैं कि कौन सी states मौजूद हैं और कौन से transitions वैध हैं — असंभव states को असंभव बनाता है।
The problem: boolean soup
[isLoading, setLoading] = ();
[isError, setError] = ();
[isSuccess, setSuccess] = ();
