1.2.0 • Published 11 months ago

use-idle-detection v1.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
11 months ago

use-idleDetection

Custom hook to detect if the user is idle or not.

Installation

npm install use-idle-detection

with yarn:

yarn add use-idle-detection

Usage

import React from "react"

import useIdleDetection from "use-idle-detection"

const App = () => {
  const { isIdle } = useIdleDetection({
    timeout: 1000
  })

  return (
    <div>
      <h1>{isIdle ? "Idle" : "Not Idle"}</h1>
    </div>
  )
}

Options

NameTypeDefaultDescription
idleTimeoutnumber3000The amount of time in milliseconds before the user is considered idle

License

MIT


Made with ❤️ by Muzammil Bilwani