# @fortissimo/hook

> react hooks函数库

Latest version **0.2.4** (published 2022-09-08) · Apache license · 0 weekly downloads

## Install

```sh
npm install @fortissimo/hook
pnpm add @fortissimo/hook
yarn add @fortissimo/hook
bun add @fortissimo/hook
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.4 |
| Published | 2022-09-08 |
| First published | 2022-03-02 |
| Weekly downloads | 0 |
| License | Apache |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=16.0.0 |
| Dependencies | 0 |
| Unpacked size | 19.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | qinshixixing |
| Maintainers | qinshixixing |

## Links

- npm: https://www.npmjs.com/package/@fortissimo/hook
- Repository: https://github.com/qinshixixing/fortissimo
- Homepage: https://github.com/qinshixixing/fortissimo#readme
- Issues: https://github.com/qinshixixing/fortissimo/issues
- npm.io page: https://npm.io/package/@fortissimo/hook

## Recent versions

- 0.2.4 (latest) — 2022-09-08
- 0.2.3 — 2022-08-10
- 0.2.2 — 2022-08-10
- 0.2.1 — 2022-06-24
- 0.2.1-0 — 2022-06-24
- 0.2.0 — 2022-04-28
- 0.1.0 — 2022-03-02

## README

# @nebula/hook

react hooks函数库

```shell script
npm i @nebula/hook
```

### 使用示例

```typescript jsx
import React, { useState } from 'react';
import { useWatch } from '@tb-util/hook';

export function Main() {
  const [data, setData] = useState(0)
  useWatch(() => {}, data);
  return (
    <div onclick={() => {
        setData(data + 1)
      }}
    >
      {data}
    </div>
  );
}
```

### API

|hook名| 功能                     |返回值|备注|
|---|------------------------|---|---|
|useMount| 在组件挂载后执行的一次性操作         |void|
|useWatch| 在被监听数据变化后执行的操作，可对比前后数据 |void|
|useInitStore| 初始化store               |Store<T>|
|useInitSimpleStore| 初始化简易store             |SimpleStore<T>|
|useCustomEventTarget| 生成或获取自定义事件中心           |CustomEventTarget|
|useCustomEventListener| 给自定义事件中心监听事件           |void|
|useEventTarget| 生成或获取事件中心              |EventTarget|
|useEventListener| 给事件中心监听事件              |void|
|useStorageMessage| 监听本地存储发送消息事件           |void|

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