manifold/web/hooks/use-user.ts
2021-12-09 16:44:04 -06:00

12 lines
266 B
TypeScript

import { useEffect, useState } from 'react'
import { listenForLogin, User } from '../lib/firebase/users'
export const useUser = () => {
const [user, setUser] = useState<User | null>(null)
useEffect(() => {
return listenForLogin(setUser)
}, [])
return user
}