'Is there any difference between Firebase auth.onAuthStateChanged((user)=>{}) vs onAuthStateChanged(auth,(user)=>{})?

I am using the modular Firebase JS SDK v9, and I have seen both of these function variations used with that SDK.

Is there any difference between these...

Variation 1:

auth.onAuthStateChanged((firebaseUser) => {
  // Do some stuff
});

Variation 2:

onAuthStateChanged(auth, (firebaseUser) => {
  // Do some stuff
});

I think both work the same and both return an unsubscrubibe function.

But maybe there is a small difference I don't understand.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source