Skip to content

Commit

Permalink
doc: change doc
Browse files Browse the repository at this point in the history
  • Loading branch information
brickspert committed Nov 10, 2021
1 parent 14c577c commit c9708fd
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { useRequest } from 'ahooks';

## 💻 Online Experience

[![Edit demo for ahooks](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/demo-for-ahooks-t7o7v?fontsize=14&hidenavigation=1&theme=dark)
[![Edit demo for ahooks](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/demo-for-ahooks-forked-fg79k?file=/src/App.js)

## 🤝 Contributing

Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import { useRequest } from 'ahooks';

## 💻 在线体验

[![Edit demo for ahooks](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/demo-for-ahooks-t7o7v?fontsize=14&hidenavigation=1&theme=dark)
[![Edit demo for ahooks](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/demo-for-ahooks-forked-fg79k?file=/src/App.js)

## 🤝 参与共建

Expand Down
39 changes: 23 additions & 16 deletions docs/guide/upgrade.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@
- 修复了已知问题
- 新增了更多的 Hooks

## 升级建议

我们发布了 `ahooks-v2` 包,你可以同时安装 v2 和 v3 依赖,以过渡升级。

```
npm install ahooks-v2 --save
npm install ahooks@next --save
```

## 全新的 useRequest

useRequest 完全进行了重写:
Expand All @@ -29,10 +38,9 @@ useRequest 完全进行了重写:
- 删除了 `fetchKey`,也就是删除了并行能力。
- 删除了 `formatResult``initialData``ready``thrownError`
- 不再默认集成请求库,`service` 不再支持字符换或对象。

- 新增了 `runAsync``refreshAsync`,原来的 `run` 不再返回 Promise。
- 新增了错误重试能力。
- 新增了 `onBefore``onFinally` 生命周期。
- 新增了 `runAsync``refreshAsync`
- 所有参数支持动态变化。
- 防抖/节流模式下,`runAsync` 可以返回正常 Promise。
- 防抖/节流支持更多参数。
Expand Down Expand Up @@ -94,14 +102,14 @@ v3 修复了在 react-refresh(HRM)模式下的一些问题。参考《[React

### 新增 Hooks

- useRafState
- useAsyncEffect
- useDeepCompareEffect
- useIsomorphicLayoutEffect
- useLatest
- usePagination
- useLongPress
- useInfiniteScroll
- [useRafState](/zh-CN/hooks/use-raf-state)
- [useAsyncEffect](/zh-CN/hooks/use-async-effect)
- [useDeepCompareEffect](/zh-CN/hooks/use-deep-compare-effect)
- [useIsomorphicLayoutEffect](/zh-CN/hooks/use-isomorphic-layout-effect)
- [useLatest](/zh-CN/hooks/use-latest)
- [usePagination](/zh-CN/hooks/use-pagination)
- [useLongPress](/zh-CN/hooks/use-long-press)
- [useInfiniteScroll](/zh-CN/hooks/use-infinite-scroll)

### Break Change

Expand Down Expand Up @@ -130,6 +138,7 @@ v3 修复了在 react-refresh(HRM)模式下的一些问题。参考《[React
- useLocalStorageState / useSessionStorate

- 第二个参数从 `defaultValue` 变为了 `Options`,使用 `options.defaultValue` 代替
- 增加了 `options.serializer``options.deserializer`,支持自定义序列法方法

- useDynamicList

Expand All @@ -152,6 +161,7 @@ v3 修复了在 react-refresh(HRM)模式下的一些问题。参考《[React
- useVirtualList

- API 重新设计,需要对照新的文档做升级
- `options.itemHeight` 参数增加了 `data` 参数

- useInViewport

Expand All @@ -173,10 +183,12 @@ v3 修复了在 react-refresh(HRM)模式下的一些问题。参考《[React
- useAntdTable

- 删除了 `options.formatResult`
- 更多变更同 useRequest

- useFusionTable

- 删除了 `options.formatResult`
- 更多变更同 useRequest

- usePersistFn 更名为 useMemoizedFn

Expand All @@ -192,9 +204,4 @@ v3 修复了在 react-refresh(HRM)模式下的一些问题。参考《[React

- 受控模式下,不再维护内部状态,避免额外的 rerender

- useLocalStorageState / useSessionStorate

- 增加了 `options.serializer``options.deserializer`,支持自定义序列法方法

- useVirtualList
- `options.itemHeight` 参数增加了 `data` 参数
- 更多其它优化
6 changes: 3 additions & 3 deletions docs/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ hero:
image: /logo.svg
desc: A high-quality & reliable React Hooks library
actions:
- text: Quick Start
link: /guide/quick-start
- text: Guide
link: /guide
- text: Hooks List
link: /zh-CN/hooks
footer: Open-source MIT Licensed | Copyright © 2019-present<br />Powered by [dumi](https://d.umijs.org)
Expand Down Expand Up @@ -44,7 +44,7 @@ import { useRequest } from 'ahooks';

## 💻 Online Experience

[![Edit demo for ahooks](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/demo-for-ahooks-t7o7v?fontsize=14&hidenavigation=1&theme=dark)
[![Edit demo for ahooks](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/demo-for-ahooks-forked-fg79k?file=/src/App.js)

## 🤝 Contributing

Expand Down
6 changes: 3 additions & 3 deletions docs/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ hero:
image: /logo.svg
desc: 一套高质量可靠的 React Hooks 库
actions:
- text: 快速上手
link: /zh-CN/guide/quick-start
- text: 指南
link: /zh-CN/guide
- text: Hooks 列表
link: /zh-CN/hooks
footer: Open-source MIT Licensed | Copyright © 2019-present<br />Powered by [dumi](https://d.umijs.org)
Expand Down Expand Up @@ -44,7 +44,7 @@ import { useRequest } from 'ahooks';

## 💻 在线体验

[![Edit demo for ahooks](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/demo-for-ahooks-t7o7v?fontsize=14&hidenavigation=1&theme=dark)
[![Edit demo for ahooks](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/demo-for-ahooks-forked-fg79k?file=/src/App.js)

## 🤝 参与共建

Expand Down

0 comments on commit c9708fd

Please sign in to comment.