This repository contains a collection of custom React hooks implementation that you can use in your projects to enhance functionality and streamline development.
-
useAsync: Simplify asynchronous operations with loading, error, and value states.
-
useIdle: Detect user inactivity within a web application for implementing features like automatic logout.
-
useFocus: Track the focus state of DOM elements within React components.
-
usePrevious: Store and persist the previous state between re-renders for comparison purposes.
-
useLocalStorage: Synchronize component state with local storage for data persistence.
-
useDebounce: Add debounce functionality to delay function execution and limit frequency.
-
useThrottle: Manage execution frequency by ensuring updates occur at most every specified interval.
-
useFetch: Simplify data fetching and state management with consistent loading, success, and error states.
-
useToggle: Efficiently toggle between two states for various UI interactions.
-
useWindowScroll: Track and manipulate scroll position within React components.
-
useOnClickOutside: Useful for detecting clicks outside a specific component.
-
useArray: Useful for implementing array functionality and methods.
-
useResponsive: It returns the device type (isMobile, isTablet, isDesktop) depending upon the window width.
-
useScript: It is useful for dynamically loading external JavaScript scripts into a React component.
-
Highlight Text on Selection: Hook in React that will return the selected text on the web page and the coordinates of the selection so that a popup can be shown to Tweet the selected text just like Medium.