one-hook

Introduction

one-hook is a carefully crafted collection of React hooks, where each hook does one thing and does it well. Following the Unix philosophy of modularity, each hook is independently packaged and can be installed separately, ensuring minimal bundle size and maximum flexibility.

Why one-hook?

Many React hook libraries bundle everything together in a single package with barrel exports. While this might seem convenient at first, it comes with several drawbacks:

  • Performance Issues: Barrel exports slow down TypeScript and bundlers, especially as the library grows.
  • Dependency Hell: When some hooks don't fit your needs, you end up with multiple hook libraries, each with its own dependencies and potential breaking changes.
  • Editor Bloat: Autocomplete gets cluttered with duplicate exports from different libraries.
  • Inconsistent Quality: Bundled libraries often contain hooks of mixed quality - some well-maintained, others neglected.

one-hook addresses these pain points by:

  • Individual Packages: Each hook is a separate package, improving TypeScript and bundler performance.
  • Clean Autocomplete: You only see what you've installed, keeping your editor suggestions clean and relevant.
  • Seamless Integration: Works well alongside other hook libraries without duplicate imports.
  • Unified Versioning: Update all one-hook packages with a single version change, making maintenance simple.
  • Curated Quality: Every hook is TypeScript-first and held to high quality standards.

Key Features

  • 🎯 Single Responsibility: Each hook does one thing exceptionally well.
  • 📦 Tree-shakeable: Import only what you need.
  • 💪 TypeScript-first: Built with TypeScript for excellent type safety and IntelliSense support.
  • 🧪 Well-tested: Comprehensive test coverage for reliability.
  • 📚 Well-documented: Clear, concise documentation with practical examples.
  • 🔄 Unified Versioning: All hooks share the same version number for easy updates and maintenance.

On this page