react-firebase-hooks
react-firebase-hooks copied to clipboard
Fix useLoadingValue perf issue
I'm using useAuthState
in my application and found it causing my component re-render infinitely, after some debugging, I noticed the problem is in useLoadingValue
, the returned setValue
and setError
are changing every time it re-run. (useMemo doesn't help here). We need to use useCallback
to prevent them from changing.