ideas
ideas copied to clipboard
useIdle
Check if user is idle.
import useIdle from "@rehooks/idleMonitor"
function MyComponent() {
const [isIdle, resume, pause] = useIdleMonitor();
return (
<div>
{isIdle && <span>you are idle</span>}
<button onClick={pause}>Pause idle monitor</button>
<button onClick={resume}>Resume idle monitor</button>
</div>
);
}
I will give this a go.
@vanthiyathevan I don't know how you are tracking user idleness, I think you are going to attach a mouse listener and keyboard listener to the state.
I have a suggestion, in that case, please include a threshold for triggering.