acc9c84e2e
* Configure functions module to allow absolute imports * Convert common imports in functions to be absolute * Convert common imports in web to be absolute * Convert lib imports in web to be absolute * Convert hooks imports in web to be absolute * Convert components imports in web to be absolute
14 lines
389 B
TypeScript
14 lines
389 B
TypeScript
import { useEffect, useState } from 'react'
|
|
import { Answer } from 'common/answer'
|
|
import { listenForAnswers } from 'web/lib/firebase/answers'
|
|
|
|
export const useAnswers = (contractId: string) => {
|
|
const [answers, setAnswers] = useState<Answer[] | undefined>()
|
|
|
|
useEffect(() => {
|
|
if (contractId) return listenForAnswers(contractId, setAnswers)
|
|
}, [contractId])
|
|
|
|
return answers
|
|
}
|