@guanghechen/react-hooks
Version:
87 lines (72 loc) • 2.57 kB
Markdown
<header>
<h1 align="center">
<a href="https://github.com/guanghechen/react-kit/tree/@guanghechen/react-hooks@3.0.14/packages/react-hooks#readme">@guanghechen/react-hooks</a>
</h1>
<div align="center">
<a href="https://www.npmjs.com/package/@guanghechen/react-hooks">
<img
alt="Npm Version"
src="https://img.shields.io/npm/v/@guanghechen/react-hooks.svg"
/>
</a>
<a href="https://www.npmjs.com/package/@guanghechen/react-hooks">
<img
alt="Npm Download"
src="https://img.shields.io/npm/dm/@guanghechen/react-hooks.svg"
/>
</a>
<a href="https://www.npmjs.com/package/@guanghechen/react-hooks">
<img
alt="Npm License"
src="https://img.shields.io/npm/l/@guanghechen/react-hooks.svg"
/>
</a>
<a href="#install">
<img
alt="Module Formats: cjs, esm"
src="https://img.shields.io/badge/module_formats-cjs%2C%20esm-green.svg"
/>
</a>
<a href="https://github.com/nodejs/node">
<img
alt="Node.js Version"
src="https://img.shields.io/node/v/@guanghechen/react-hooks"
/>
</a>
<a href="https://github.com/vitest-dev/vitest">
<img
alt="Tested with Vitest"
src="https://img.shields.io/badge/tested_with-vitest-6E9F18.svg"
/>
</a>
<a href="https://github.com/prettier/prettier">
<img
alt="Code Style: prettier"
src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"
/>
</a>
</div>
</header>
<br/>
`@guanghechen/react-hooks` provides some common custom react hooks.
## Install
* npm
```bash
npm install --save @guanghechen/react-hooks
```
* pnpm
```bash
pnpm add @guanghechen/react-hooks
```
## Usage
Name | Description
:------------------------:|:---------------------------------------------:
`useDeepCompareCallback` | Deep compare version of `React.useCallback`
`useDeepCompareEffect` | Deep compare version of `React.useEffect`
`useDeepCompareMemo` | Deep compare version of `React.useMemo`
`useEventCallback` | Create event handler with an always-stable function identity.
`useInterval` | Execute callback interval in react function components
`usePreviousState` | Use previous state
## Related
* [Custom React Hooks | 光和尘](https://me.guanghechen.com/post/web/react/hooks/custom/)
[homepage]: https://github.com/guanghechen/react-kit/tree/@guanghechen/react-hooks@3.0.14/packages/react-hooks#readme