manifold/web/hooks/use-transactions.ts
2022-03-31 21:52:06 -07:00

12 lines
337 B
TypeScript

import { useState, useEffect } from 'react'
import {
listenForTransactions,
Transaction,
} from '../lib/firebase/transactions'
export const useTransactions = () => {
const [transactions, setTransactions] = useState<Transaction[] | undefined>()
useEffect(() => listenForTransactions(setTransactions), [])
return transactions
}