Run a function only once for all instances
Hello,
I'm in an interesting predicament. I have a hook that looks something like this:
My problem is that
useUser is called in multiple different places and the onAuthStateChange is called and set up several times. Is there any way that I can make it so that onAuthStateChange will only ever be called once? I could move it outside the component (top of the file) but I lose the ability to access query.refetch()1 Reply
other-emeraldOP•3y ago
Silly question, I think I can just move the
useEffect to my App component and just useUser there