loading...

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

TOP OF THREAD FULL DISCUSSION
re: I disagree with this article. I dont think you should be using a loading state at all. If the data is null, you are loading. If an error is present...
 

This is also an interesting take! So you're saying instead of storing a separate enum string value, just derive the status based on whether or not data or error are not null?

The one case I could argue against this for is re-fetching. Say you have a list of data, and you'd like to re-fetch or fetch more...your original data wouldn't be null...therefore how could you indicate to the user that you were re-fetching / fetching more?

Code of Conduct Report abuse