Loading homepage
Detect inactivity with a React hook that resets on browser activity and cleans up timers and listeners.
Input: function Presence() { const idle = useIdle(30000); return <span>{idle ? "Away" : "Active"}</span>; } Output: Active initially; Away after 30 seconds without activity.
Input: const idle = useIdle(); Output: The default idle deadline is 60000 ms; window activity resets it.
Implement the exported React hook in index.js or index.ts. Tests provide fixtures for the required behavior.