manifold/web/hooks/use-user.ts

12 lines
266 B
TypeScript
Raw Normal View History

2021-12-09 22:44:04 +00:00
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
}