manifold/web/hooks/use-transactions.ts

12 lines
337 B
TypeScript
Raw Normal View History

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
}