I have a deconstructured array of values, as instructed in the docs. (react-firebase-hooks)
const [ signInWithEmailAndPassword, loading, error] = useSignInWithEmailAndPassword(auth);
All is fine, but what if I have another hook with the same return keys:
const [ signInWithEmailAndPassword, loading, error] = useSignInWithEmailAndPassword(auth);
const [ signInWithGoogle, loading, error ] = useSignInWithGoogle(auth);
As I cannot redeclare variables, how would I solve this?
I want to eventually return a spinner, if either loading value is true.
What I tried: Assigning a new variable name inside the deconstructor.
What I was expecting: My expectations were open.
2
Answers
you don’t have to do it like this:
simply replace it with
the the destruction only take it out from the array, but this way you keep it as array and refer to its index
You can reassign the names like this: