DEV Community

Discussion on: Status instead of isLoading boolean?

Collapse
 
deepanjangh profile image
Deepanjan Ghosh

Enum also helps in expanding the feature more in the future if the need arise. Make things more cleaner and easier to read!!

Collapse
 
adarshaacharya profile image
Aadarsha Acharya 🚀

Hi, how would you implement enum over here?
I'm definining my state types as :

export interface AuthState {
  status: 'idle' | 'pending' | 'resolved' | 'rejected';
  isAuthenticated: boolean;
  error: string;
  user: User;
}
Enter fullscreen mode Exit fullscreen mode

and giving me type safety. Are you talking about making StatusEnum?