loading...

re: Opinionated React - Use Status Enums Instead of Booleans VIEW POST

TOP OF THREAD FULL DISCUSSION
re: The first time I ran into this problem, I switched to using numbers. 0 = not started, 1 = in progress, 2 = ready, 3 = post loading processes, etc. ...
 

I did the same! But like you said, having to remember what all the numbers represented was difficult.

 

I actually tried using constants. NOT_STARTED, LOADING, etc. But enums was still better because of auto-complete and working with interfaces. Taking an enum type as the status is just more descriptive than an int, whether it's written as a constant or otherwise lol

code of conduct - report abuse