Getting Started

React Hooks Library is a collection of hooks and utilities for React. It is currently available for use in Node environments and works with any react meta framework like next, vite, astro. Support for Deno and browsers is coming soon.

⚠️

The library is currently not v1 yet, while it's mostly stable, some aspects of the API may change.

Installation

npm i @react-hooks-library/core

Usage

import {
  useMediaStream,
  useKeyDown,
  useOnline
} from '@react-hooks-library/core'

export function Demo() {
  const isOnline = useOnline()

  useKeyDown(['w', 'W', 'ArrowUp'], (e) => {
    console.log('w or W or ArrowUp was pressed')
  })

  const { ref, pause, resume, play, stop } = useMediaStream()

  return <div>Hello World</div>
}

Read the list of all function to know more.