Table of Contents
Hook nameDescription
useArrayProvides advanced management of an array of items with a variety of functions, including: adding new items, removing items by id or index, replacing an item by specific id or index, shuffling the array, sorting in ascending or descending order, and clearing the array entirely.
useUUIDGenerates a highly customizable unique identifier with advanced options to define prefix, length, special characters, and exclusions, while ensuring optimized performance.
useFieldsPopulatedChecks if all fields within an object are populated, returning a boolean that updates automatically as field values change.
useSortObjByPropertySorts an array of objects by a specified property, allowing for optional ascending or descending order. Returns a stable sorted array that updates automatically when the input array or sort conditions change.
useMediaQueryUsed to check if the screen size is within a certain range. This hook can be used to conditionally render components based on screen size, or to apply different styles based on screen size.
useStorageManages state in localStorage or sessionStorage with optional expiration, allowing stored values to persist across sessions and automatically update when modified.
useBrowserLanguageRetrieves the browser's language settings, allowing for customizable formatting options (short/full and text transformation) to enhance readability. Automatically updates when the browser's language changes.
useCopyToClipboardCustom hook for copying text to the clipboard, with an optional callback function to handle success or failure of the copy operation.
useToggleCustom hook for managing a boolean state with toggle functionality. It supports an optional initial value and can store the state in localStorage for persistence across sessions. Includes methods to toggle the state, set it to a specific value, and check if it matches an expected value
useOnlineStatusDetects online status by providing a boolean value (true/false) that updates in real-time based on changes in network connectivity.
useWindowScrollTracks the window's scroll position, providing detailed information including absolute coordinates and percentage of total scroll for both the X and Y axes.
usePaginationThis custom hook facilitates pagination of an array of data by allowing you to specify the number of items per page. It provides navigation functions to go to specific pages, move to the next or previous page, and access the first or last page, along with the currently displayed data for the active page.
usePreviousValuesStore previous values with a limit. Default is 1 and optional "remove duplicates function" if unique is true.
useHoverThis custom hook detects when an element is in a hover state, providing a boolean value. It accepts a target that can be specified by a string identifier (ID or class) or a ref. Additionally, it allows for customizable behavior through an options object, which includes delay settings and callback functions for when the hover starts and ends.
useElementVisibilityManages the visibility state of a specific element. Returns a boolean value indicating its visibility state.