manifold/web/hooks/use-user.ts
2021-12-09 16:09:16 -08:00

9 lines
254 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(() => listenForLogin(setUser), [])
return user
}