useIdle
useIdle
is a custom hook that detects whether the user has been idle for a certain amount of time in milliseconds.
Import
import { useIdle } from "@yamada-ui/react"
Usage
Editable example
const idle = useIdle(2000) return ( <Box bg={idle ? "blue.500" : "red.500"} p="md" rounded="md" color="white" transitionProperty="all" transitionDuration="slower" > Current state: {idle ? "idle" : "not idle"} </Box> )
Edit this page on GitHub