Implement a function useIdle(timeout) that detects user inactivity.
The function should:
true if the user has been idle for the given duration, otherwise false.Example
const isIdle = useIdle(5000); // returns a function // Call the returned function to check if idle console.log(isIdle()); // false initially // After 5 seconds of no activity console.log(isIdle()); // true
JavaScript Function
No test results yet
Click "Run" to execute tests