DEV Community

Discussion on: Status instead of isLoading boolean?

Collapse
 
sgolovine profile image
Sunny Golovine

This article makes me feel very (type) unsafe. But seriously, I would not recommend this route unless

  • You use Typescript
  • Store each status as an enum.

The big issue I have is the inevatable instance where you spell 'loadng' instead of 'loading' and your logic breaks. This can be avoided using union types in typescript of creating an enum with regular JS.

Collapse
 
maciekgrzybek profile image
Maciek Grzybek

That's why we should all move to TS :) oh and also I'd recommend union types instead of enums