552e6e6c3a
* Show custom feed of contracts from folds your follow or have bet on. * Add tw-elements UI library * Add loading spinner while feed loads * Switch from onSnapshot to our listenForValues, which doesn't set with partial cached values * Change home tags to communities * Remove tw-elements for now
13 lines
344 B
TypeScript
13 lines
344 B
TypeScript
import { useEffect, useState } from 'react'
|
|
import { Bet, listenForUserBets } from '../lib/firebase/bets'
|
|
|
|
export const useUserBets = (userId: string | undefined) => {
|
|
const [bets, setBets] = useState<Bet[] | undefined>(undefined)
|
|
|
|
useEffect(() => {
|
|
if (userId) return listenForUserBets(userId, setBets)
|
|
}, [userId])
|
|
|
|
return bets
|
|
}
|