A curated drawer of React hook libraries and utilities, grouped by what they do. Companion to the React Resources page.

Hook collections

Large grab-bag libraries covering most common needs.

ResourceWhy it is useful
react-useBig, well-maintained collection of essential hooks.
ahooks (alibaba/hooks)Comprehensive, production-tested hook library from Alibaba.
rooksStandalone, tree-shakeable collection of hooks.
react-essential-toolsHooks plus components for everyday needs.
react-haikuTiny utility hook collection.
Mantine hooksStandalone hooks package from the Mantine ecosystem.

State

ResourceWhy it is useful
use-optional-stateBuild components that work both controlled and uncontrolled.
react-powerplugRenderless components / HOCs for sharing stateful logic.
use-query-stateSync state with the URL query string.
react-lifecycle-hooksClass-style lifecycle hooks for function components.

HTTP / data fetching

ResourceWhy it is useful
use-httpHook for making HTTP requests with caching and SSR support.

Storage

ResourceWhy it is useful
react-storage-hooksHooks for localStorage and sessionStorage.

Media queries / responsive

ResourceWhy it is useful
react-responsiveMedia query hook and component for responsive UIs.
react-sizesHOC for tracking and reacting to window size.
Building a custom React media query hookWalkthrough of rolling your own useMedia hook.

A minimal useMedia implementation:

function useMedia(query) {
  const [matches, setMatches] = useState(window.matchMedia(query).matches)

  useEffect(() => {
    const media = window.matchMedia(query)
    if (media.matches !== matches) {
      setMatches(media.matches)
    }
    const listener = () => {
      setMatches(media.matches)
    }
    media.addEventListener(listener)
    return () => media.removeEventListener(listener)
  }, [matches, query])

  return matches
}

// Example usage:
function SomeComponent() {
  let isWide = useMedia('(min-width: 800px)')
  return (<div>The window is {isWide ? 'wide' : 'not wide'}</div>)
}

Forms / validation

ResourceWhy it is useful
validator.jsLightweight form validation.

Lists / selection

ResourceWhy it is useful
use-item-listHook for building accessible select/list widgets.

Virtualization

ResourceWhy it is useful
react-cool-virtualVirtualize long lists and grids for performance.

Utilities

ResourceWhy it is useful
use-sidecarCode-split side effects to shrink bundle size.
copy-as-markdownCopy rendered content as markdown.