Skip to content

This repository lists a variety of custom react hooks to help improve functionality and simplify development in react projects.

Notifications You must be signed in to change notification settings

rohitbisht01/custom-react-hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Custom Hooks Underlying Implementation

This repository contains a collection of custom React hooks implementation that you can use in your projects to enhance functionality and streamline development.

Included Hooks

  • 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.

  • useCopyToClipboard: Copy text to the clipboard.

  • 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.

About

This repository lists a variety of custom react hooks to help improve functionality and simplify development in react projects.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published