Introduction
A collection of helpers for use in React projects.
Installation
npm install @wethegit/react-hooks
Hooks
useAnimatePresence
Helps you animate components in and out of the DOM.
useAsync
Manages the calling of an asynchronous function, while providing the return data and the state of the function call.
useInView
Detects whether a DOM element is in the viewport, using the IntersectionObserver
API.
useMediaQuery
Matching a media query.
usePersistedMediaQuery
Matching a media query and persisting the result in localStorage.
usePersistedState
Persisting state in localStorage.
usePreventScroll
Prevents scrolling of the <body>
element.
useUserPrefs
Maintains a globally-available data store for the user's a11y preferences.