import { useEffect, useState } from 'react' import { Comment, listenForComments, listenForRecentComments, } from 'web/lib/firebase/comments' export const useComments = (contractId: string) => { const [comments, setComments] = useState() useEffect(() => { if (contractId) return listenForComments(contractId, setComments) }, [contractId]) return comments } export const useRecentComments = () => { const [recentComments, setRecentComments] = useState() useEffect(() => listenForRecentComments(setRecentComments), []) return recentComments }