Bpistle/src/hooks/useFetchPollResults.tsx
Cody Tseng b35e0cf850
feat: polls (#451)
Co-authored-by: silberengel <silberengel7@protonmail.com>
2025-07-27 12:05:50 +08:00

9 lines
313 B
TypeScript

import pollResults from '@/services/poll-results.service'
import { useSyncExternalStore } from 'react'
export function useFetchPollResults(pollEventId: string) {
return useSyncExternalStore(
(cb) => pollResults.subscribePollResults(pollEventId, cb),
() => pollResults.getPollResults(pollEventId)
)
}