Switch back to useEffect instead of useLayoutEffect, because nextjs complained.
This commit is contained in:
parent
7fd3cc185f
commit
e82b66959b
|
@ -1,11 +1,10 @@
|
||||||
import { useEffect, useLayoutEffect, useState } from 'react'
|
import { useEffect, useState } from 'react'
|
||||||
import { listenForLogin, listenForUser, User } from '../lib/firebase/users'
|
import { listenForLogin, listenForUser, User } from '../lib/firebase/users'
|
||||||
|
|
||||||
export const useUser = () => {
|
export const useUser = () => {
|
||||||
const [user, setUser] = useState<User | null | undefined>(undefined)
|
const [user, setUser] = useState<User | null | undefined>(undefined)
|
||||||
|
|
||||||
// Use layout effect to trigger re-render before first paint.
|
useEffect(() => listenForLogin(setUser), [])
|
||||||
useLayoutEffect(() => listenForLogin(setUser), [])
|
|
||||||
|
|
||||||
const userId = user?.id
|
const userId = user?.id
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user