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

reactilities

v0.1.6

Published

A comprehensive collection of useful React hooks and utilities for modern web development

Readme

🚀 Reactilities

A comprehensive collection of useful React hooks and utilities for modern web development. Built with TypeScript for excellent developer experience and type safety.

npm version TypeScript Test Coverage

📦 Installation

npm install reactilities
# or
yarn add reactilities
# or
pnpm add reactilities

🎯 Features

  • 🪝 25+ React Hooks - DOM manipulation, state management, and utility hooks
  • 🔄 Lifecycle Helpers - Class component lifecycle methods as hooks
  • 🎨 Helper Functions - Utility functions for common tasks
  • 🔷 TypeScript Types - Utility types for better type safety
  • 📱 TypeScript First - Full TypeScript support with excellent IntelliSense
  • 🧪 Well Tested - 99%+ test coverage with 140+ tests
  • 📦 Tree Shakable - Import only what you need
  • 🚀 Zero Dependencies - No external dependencies except React
  • 📚 Comprehensive Docs - Each hook has its own detailed README

📚 API Reference

Each hook and utility has its own detailed documentation with examples. Click on any item below to see full documentation.

🎨 DOM Hooks

Hooks for DOM manipulation and browser APIs.

🔄 State Hooks

Hooks for state management and persistence.

⚡ Utility Hooks

Performance and utility hooks for common patterns.

🔄 Lifecycle Hooks

Class component lifecycle methods as hooks.

🎨 Helper Functions

Utility functions for common tasks.

🔷 TypeScript Types

Utility types for better type safety.

  • Nullable<T> - Makes a type nullable (T | null)
  • Maybe<T> - Makes a type nullable and undefined (T | null | undefined)
  • ValueOf<T> - Extracts all possible values from an object type
  • DeepPartial<T> - Makes all properties optional recursively
  • VoidFunction<T> - Type for void-returning functions with typed parameters

🚀 Quick Start

import { 
  useLocalStorage, 
  useDebounce, 
  useMediaQuery,
  classnames 
} from 'reactilities';

function App() {
  // Persist theme preference
  const [theme, setTheme] = useLocalStorage('theme', 'light');
  
  // Debounce search input
  const [search, setSearch] = useState('');
  const debouncedSearch = useDebounce(search, 300);
  
  // Responsive design
  const isMobile = useMediaQuery('(max-width: 768px)');
  
  // Conditional classes
  const buttonClass = classnames('btn', {
    'btn-primary': theme === 'light',
    'btn-dark': theme === 'dark',
    'btn-sm': isMobile
  });
  
  return (
    <div>
      <button className={buttonClass} onClick={() => setTheme(t => t === 'light' ? 'dark' : 'light')}>
        Toggle Theme
      </button>
      <input 
        value={search}
        onChange={(e) => setSearch(e.target.value)}
        placeholder="Search..."
      />
    </div>
  );
}

🔧 TypeScript Support

All hooks and utilities are written in TypeScript with full type definitions:

// Type inference works automatically
const [user, setUser] = useLocalStorage('user', { name: 'John', age: 30 });
// user is typed as { name: string; age: number }

// Generic types are supported
const debouncedValue = useDebounce<string>('hello', 300);
const throttledValue = useThrottle<number>(scrollY, 100);

// Utility types
type User = { id: string; name: string; email: string };
type NullableUser = Nullable<User>; // User | null
type MaybeUser = Maybe<User>; // User | null | undefined
type PartialUser = DeepPartial<User>; // All properties optional

🧪 Testing

Reactilities comes with comprehensive tests:

  • 140+ tests covering all functionality
  • 99%+ code coverage
  • Tested with Vitest and React Testing Library

📄 License

MIT © Petar Basic

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📝 Changelog

v0.1.4

  • Refactored to modular structure - each hook has its own folder with README
  • Added comprehensive documentation for all hooks
  • Improved test coverage to 99%+
  • Added more TypeScript utility types

v0.1.3

  • Added lifecycle hooks and helper functions
  • Improved TypeScript support

v0.1.2

  • Fixed export issues - all hooks now use named exports
  • Removed test files from distribution bundle

v0.1.1

  • Fixed hook exports and improved TypeScript support

v0.1.0

  • Initial release with 25+ hooks and utilities

⭐ Star History

If you find this library useful, please consider giving it a star on GitHub!


Made with ❤️ by Petar Basic