Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changeset/eight-webs-look.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'classic-react-hooks': minor
---

New api and props for use-debounced-fn
- Introduce cleanup and debouncedFn return value
- Introduce immediateCallback, onSuccess, onError and onFinally callback as lifecycle functions
10 changes: 9 additions & 1 deletion apps/doc/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* Each colors have exact same color scale system with 3 levels of solid
* colors with different brightness, and 1 soft color.
*
*
* - `XXX-1`: The most solid color used mainly for colored text. It must
* satisfy the contrast ratio against when used on top of `XXX-soft`.
*
Expand Down Expand Up @@ -128,3 +128,11 @@
.DocSearch {
--docsearch-primary-color: var(--vp-c-brand-1) !important;
}

/* Dynamic color for icons in index.md */
html.dark .icon-color-theme {
fill: #e7e7e7;
}
.icon-color-theme {
fill: currentColor;
}
34 changes: 20 additions & 14 deletions apps/doc/getting-started/overview.md
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
# Overview

**_`classic-react-hooks`_** is a lightweight yet powerful library of custom _react-hooks_ and _components_ that streamline everyday development.
**_`classic-react-hooks`_** is a lightweight yet robust library of custom React hooks and components designed to simplify and streamline everyday development tasks.

It encourages you to write _`clean`_, _`declarative`_, _`modular`_, and _`predictable`_ code that remains easy to maintain and scale as your project grows.
It promotes _`clean`_, _`declarative`_, _`modular`_, and _`predictable`_ code, making applications easier to maintain and scale as they grow.

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).
Built with `TypeScript` and a strong emphasis on type safety, the library is _`minimal`_, _`tree-shakable`_, and optimized for modern React applications. All hooks are fully compatible with server-side rendering _`(SSR)`_, ensuring no hydration mismatches.

The library is thoroughly tested using _`Vitest`_ and _`React-Testing-Library`_, covering a wide range of use cases. Contributions of additional test cases are always welcome.

## 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.
**_`classic-react-hooks`_** is designed to provide a _`focused`_, _`predictable`_, and _`developer-friendly`_ set of React hooks that prioritize clarity, consistency, and long-term maintainability. The library emphasizes stable APIs, minimal abstractions, and practical flexibility, allowing developers to reason about behavior with confidence while building scalable applications.

In contrast, many existing hook libraries tend to focus on highly specialized use cases or offer broad collections of hooks that may not be universally applicable. Some primarily act as abstractions over smaller utility libraries, introducing additional layers of indirection without delivering proportional architectural value.

These libraries often expose _`distinct APIs`_ for individual hooks, favoring _`syntactic brevity`_ over _`predictability`_ and _`consistency`_. While this can reduce boilerplate, it may also lead to APIs that are harder to internalize, less consistent in behavior, and more constrained in real-world usage.

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.
Additionally, a common pattern among such libraries is a _`heavy reliance`_ on **useEffect**, **useCallback**, and **useMemo** for state tracking, function memoization, and lifecycle management. This frequently places the burden of dependency management and _`stale-closure`_ prevention on developers, potentially resulting in unnecessary _`re-renders`_, increased computational overhead, and more complex performance tuning.

Instead of building features you often have to focus more on learning the APIs, which becomes time consuming.
As a result, development effort often shifts away from building features toward managing library-specific APIs. **_`classic-react-hooks`_** aims to minimize this cognitive load, enabling developers to focus on delivering features rather than adapting to complex or inconsistent abstractions.

## 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
- A thoughtfully curated set of feature-rich hooks
- High performance with a minimal and lightweight footprint
- Predictable and intuitive API behavior through natural usage
- Built with TypeScript, prioritizing strong type safety
- Zero third-party dependencies
- Modular and declarative design principles
- Fully tree-shakable for optimal bundling
- Comprehensive and well-structured documentation

## Installation

Expand Down
Loading