npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@woby/use

v0.0.26

Published

@woby/use

Readme

@woby/use

A collection of essential React hooks designed for both React and Voby environments. This library provides a set of utility hooks that help you build better applications with less code.

Installation

# Using npm
npm install @woby/use

# Using yarn
yarn add @woby/use

# Using pnpm
pnpm add @woby/use

Quick Start

import { useToggle, useCounter, useLocalStorage } from '@woby/use';

function MyComponent() {
  const [value, toggle] = useToggle(false);
  const { count, increment, decrement } = useCounter(0);
  const [name, setName] = useLocalStorage('name', '');
  
  return (
    <div>
      <p>Toggle value: {() => $(value) ? 'ON' : 'OFF'}</p>
      <button onClick={toggle}>Toggle</button>
      
      <p>Count: {count}</p>
      <button onClick={increment}>+</button>
      <button onClick={decrement}>-</button>
      
      <input 
        value={name} 
        onChange={(e) => setName(e.target.value)} 
        placeholder="Enter your name" 
      />
    </div>
  );
}

Available Hooks

Core

  • use - Convert values to observables with optional cloning

State Management

  • useBoolean - Tracks state of a boolean value
  • useCounter - Tracks numerical state with increment/decrement functions
  • useToggle - Toggles between two values
  • useMap - Tracks state of a Map
  • useSet - Tracks state of a Set
  • useStep - Manages step navigation
  • useCountdown - Manages countdown timers

Browser Utilities

  • useLocalStorage - Manages localStorage values
  • useSessionStorage - Manages sessionStorage values
  • useReadLocalStorage - Reads localStorage values
  • useWindowSize - Tracks window size changes
  • useAspect - Calculates window aspect ratio
  • useViewportSize - Accesses visual viewport properties
  • useDarkMode - Tracks and toggles dark mode state
  • useTernaryDarkMode - Advanced dark mode management
  • useMediaQuery - Tracks media query matches
  • useCopyToClipboard - Copies text to clipboard
  • useDocumentTitle - Sets the document title
  • useLockedBody - Locks body scrolling
  • useElementSize - Tracks element size
  • useIntersectionObserver - Observes element intersections
  • useImageOnLoad - Handles image loading
  • useScreen - Accesses screen information
  • useGpsLocation - Accesses GPS location
  • useLocation - Accesses browser location
  • useScreenOrientation - Accesses screen orientation
  • useSelection - Accesses text selection

Events

  • useEventListener - Subscribes to events
  • useClickAnyWhere - Subscribes a callback to clicks anywhere on the page
  • useClickAway - Detects clicks outside an element
  • useOnClickOutside - Detects clicks outside an element

Effects

  • useDebounce - Debounces a value or function
  • useTimeout - Sets up a timeout that runs a callback
  • useInterval - Sets up an interval that runs a callback
  • useIsomorphicLayoutEffect - useLayoutEffect in browser, useEffect in server
  • useEffectOnce - Runs an effect only once
  • useUpdateEffect - Runs an effect on updates only

Utility

  • useFetch - Fetches data from a URL
  • useScript - Loads external scripts
  • useHover - Tracks hover state of an element
  • useDestruct - Destructures objects and arrays
  • useEventCallback - Creates stable event callbacks
  • useId - Generates unique IDs
  • useInvert - Inverts boolean values
  • usePause - Creates timed delays
  • useTimer - Creates timers
  • useTry - Executes functions with error handling

Environment

  • useSsr - Handles server-side rendering
  • useIsClient - Checks if running on client
  • useIsFirstRender - Checks if it's the first render
  • useIsMounted - Checks if component is mounted

Documentation

Check out our full documentation for detailed information about each hook:

Development

# Clone the repository
git clone https://github.com/wobyjs/use
cd @woby/use

# Install dependencies
pnpm install

# Start development server
pnpm dev

# Build for production
pnpm build:web

# Run tests
pnpm test

# Serve documentation
pnpm docs

Framework Compatibility

The hooks in this library are designed to work with:

  • React (16.8+)
  • Voby (with appropriate JSX configuration)

TypeScript Support

All hooks come with full TypeScript support and type definitions included.

Contributing

Contributions are welcome! Please read our contributing guide to get started.

License

MIT

Related Projects

  • Voby - A reactive JavaScript framework
  • React - A JavaScript library for building user interfaces