# white-react-hooks

> 手动实现 react-hooks 方案

Latest version **1.0.2** (published 2022-06-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install white-react-hooks
pnpm add white-react-hooks
yarn add white-react-hooks
bun add white-react-hooks
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2022-06-10 |
| First published | 2022-06-05 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 26.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | nlffeng |

## Links

- npm: https://www.npmjs.com/package/white-react-hooks
- npm.io page: https://npm.io/package/white-react-hooks

## Dependencies (1)

- [react](https://npm.io/package/react.md) ^16.14.0

## Recent versions

- 1.0.2 (latest) — 2022-06-10
- 1.0.1 — 2022-06-10
- 1.0.0 — 2022-06-05

## README

# white-react-hooks

React Hooks API 在低版本下的一个实现，可以在 16低版本 下体验新的 React Hooks API

## Install

```shell
npm install white-react-hooks
```

## Usage

使用 bindHooks 函数包装 函数组件 就可以使用 Hooks API 了，如下：

```javascript
import { bindHooks, useState } from 'white-react-hooks'

const Demo = (props) => {
  const [count, setCount] = useState(0)

  return (
    <div>
      <button onClick={() => setCount(count - 1)}> - </button>
      count: {count}
      <button onClick={() => setCount(count + 1)}> + </button>
    </div>
  )
}

export default bindHooks(Demo)
```

## API

- bindHooks
- useState
- useEffect

---
_Source: https://npm.io/package/white-react-hooks · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
