Overview
classic-react-hooks is a lightweight yet powerful library of custom react-hooks and components that streamline everyday development.
It encourages you to write clean, declarative, modular, and predictable code that remains easy to maintain and scale as your project grows.
This library is written with Typescript having Type-Safety in mind. It is Tree-Shakable and minimal as much as possible. All of the hooks are fully compatible with SSR(no hydration mismatch) and have been tested with all possible test cases using Vitest and React-Testing-Library (new test cases contribution are welcomed).
Motivation
Most of the hook libraries out there are specialized solution or packed with lots of unnecessary hooks. Some of them are just a wrapper on another mini-library. In which each hook introduces new syntax api which mostly focuses on small syntax and less lines of code rather than Predictability, which results in Hard to remember syntax, Unpredictable API behaviours. And they are not so flexible either.
Pretty much all of the hooks just use too much of useEffect, useCallback and useMemo hooks for keeping track of values, functions and attaching-cleaning up the events. And sometimes you have to yourself memoize them and do a work around to fix stale-closure values inside those callback . Which is not always the great choice. Because it can cause lots of recalculation and effect trigger resulting in heavy memory and cpu usage.
Instead of building features you often have to focus more on learning the APIs, which becomes time consuming.
What classic-react-hooks offers
- Feature packed Hooks
- Performant, Minimal and Lightweight
- Predictable API Behaviours(just by using it)
- Written in Typescript (Type-Safety in mind)
- No Third Party Dependencies
- Modular and Declarative
- Tree-Shakable
- Detailed Documentation
Installation
$ npm install classic-react-hooks$ pnpm add classic-react-hooks$ deno install classic-react-hooks$ yarn add classic-react-hooks$ bun add classic-react-hooks