Example 6 · 30–35 min
Data Polling
Live Table · Pause on Hidden · Manual Refresh
The Question
"Poll a public API every 5 seconds and display live results in a table. The first load should show a spinner; subsequent polls must update silently. Pause polling when the tab is hidden, resume and refresh immediately when it becomes visible again. Clean up all timers on unmount."
setInterval pollinguseCallbackuseRefvisibility pauseeffect cleanupsilent refresh
Loading…