Switch back to useEffect instead of useLayoutEffect, because nextjs complained.

This commit is contained in:
jahooma 2021-12-16 22:17:33 -06:00
parent 7fd3cc185f
commit e82b66959b

View File

@ -1,11 +1,10 @@
import { useEffect, useLayoutEffect, useState } from 'react'
import { useEffect, useState } from 'react'
import { listenForLogin, listenForUser, User } from '../lib/firebase/users'
export const useUser = () => {
const [user, setUser] = useState<User | null | undefined>(undefined)
// Use layout effect to trigger re-render before first paint.
useLayoutEffect(() => listenForLogin(setUser), [])
useEffect(() => listenForLogin(setUser), [])
const userId = user?.id