A developer with M.Sc. in Computer Science. Working professionally since 2010. In my free time I make music and cook.
Also I don't and after the recent events will not have Twitter.
Location
Budapest
Education
Eötvös Loránd University (ELTE - Budapest Hungary) Computer Science M. Sc.
This is a very valid, but a very rare use case. My point above is that whenever you use tuples you open a class of problems about "magic location". So you have to use them very sparingly with a lot of consciousness.
Here you also demonstrate that it is highly unlikely that const { data: customerError, error: customers } = useAsync(getCustomers) would happen, since it would look odd and you will not fail it.
Lastly in the example above, why don't use transform data inside getCustomers already so it returns {customers, customerError} instead? What if you realize you need to return more than two objects?
So, my point is: use it very rarely and very carefully.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Counterpoint: call the same function multiple times. Without tuples, now you have name clashes:
Returning tuples makes this issue go away. This is why React uses tuples for many hooks.
This is a very valid, but a very rare use case. My point above is that whenever you use tuples you open a class of problems about "magic location". So you have to use them very sparingly with a lot of consciousness.
Here you also demonstrate that it is highly unlikely that
const { data: customerError, error: customers } = useAsync(getCustomers)
would happen, since it would look odd and you will not fail it.Lastly in the example above, why don't use transform data inside
getCustomers
already so it returns{customers, customerError}
instead? What if you realize you need to return more than two objects?So, my point is: use it very rarely and very carefully.