Do people prefer status booleans or types? #3918
Answered
by
TkDodo
cmacdonnacha
asked this question in
General
-
I recently read this article and it made me think; what is better to use in react-query: boolean:
type:
Does it matter? Is it just a matter of preference in the case of react-query since you're not dealing with setting |
Beta Was this translation helpful? Give feedback.
Answered by
TkDodo
Jul 25, 2022
Replies: 1 comment 3 replies
-
it doesn't matter. isLoading is exactly the same as status === 'loading'. |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
cmacdonnacha
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
it doesn't matter. isLoading is exactly the same as status === 'loading'.
The article means to not store booleans in state, which react-query doesn't do. Derived booleans are fine. Probably js users prefer them because there is no type safety when comparing strings