usePolling
Call an async function on an interval without overlapping calls. It pauses while the tab is hidden and backs off after errors, so it suits status checks and dashboards that cannot use a push connection.
- Level
- Advanced
- Since
- v2.1.0
import {usePolling} from '@zenuilabs/react-hooks';Loading demo_
More in Realtime
RealtimeIntermediateuseEventSourceSubscribe to a Server-Sent Events stream and keep the latest event in state. Use it for one-way server pushes such as notifications, progress updates and price tickers where a WebSocket would be more than you need.RealtimeAdvanceduseWebSocketConnect to a WebSocket and track its status, the latest message and reconnect attempts. Use it for chat, live dashboards and multiplayer state when you need reconnects, heartbeats and a send queue without writing the socket lifecycle yourself.