c1bda8a775
* Add follow button to user page * Update follows in the database using follow button. * Add toggle for followed market creators to home * Hide follow toggle from user's markets page * Check that sold bet is by auth'd user * Change follow toggle to category pill * Remove unused imports * Remove console.logs
13 lines
352 B
TypeScript
13 lines
352 B
TypeScript
import { useEffect, useState } from 'react'
|
|
import { listenForFollows } from 'web/lib/firebase/users'
|
|
|
|
export const useFollows = (userId: string | undefined) => {
|
|
const [followIds, setFollowIds] = useState<string[] | undefined>()
|
|
|
|
useEffect(() => {
|
|
if (userId) return listenForFollows(userId, setFollowIds)
|
|
}, [userId])
|
|
|
|
return followIds
|
|
}
|