Skip to content

Instantly share code, notes, and snippets.

View Bonny-kato's full-sized avatar

Black Bonny-kato

View GitHub Profile
@Bonny-kato
Bonny-kato / React Hook for Tracking User Inactivity.md
Last active September 1, 2023 04:25
React hook called `useIdleTimer` that tracks user activity and determines if the user is currently inactive. It takes in several configuration options as arguments and returns an object containing a boolean value indicating whether the user is currently inactive.

React Hook for Tracking User Inactivity

Preview:
import {
    getValueFromLocalStorage,
    localStorageKeys,
    removeValuesFromLocalStorage,
    saveValueToLocalStorage,
} from "@/utils/local-storage";
import { TFunction } from "@/types";