Skip to content

Commit b0a67b9

Browse files
authored
docs: update docs (#2174)
* fix: add immediate to dep list * docs: update docs * style: op
1 parent 3e88330 commit b0a67b9

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

packages/hooks/src/useMutationObserver/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@ const useMutationObserver = (
1919
const observer = new MutationObserver(callbackRef.current);
2020
observer.observe(element, options);
2121
return () => {
22-
if (observer) {
23-
observer.disconnect();
24-
}
22+
observer?.disconnect();
2523
};
2624
},
2725
[options],

packages/hooks/src/useScroll/index.en-US.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ const position = useScroll(target, shouldUpdate);
2929

3030
### Params
3131

32-
| Property | Description | Type | Default |
33-
| ------------ | ------------------------- | --------------------------------------------------------------------------- | ---------- |
34-
| target | DOM element or ref object | `Element` \| `Document` \| `(() => Element)` \| `MutableRefObject<Element>` | `document` |
35-
| shouldUpdate | Whether update position | `({ top: number, left: number }) => boolean` | `-` |
32+
| Property | Description | Type | Default |
33+
| ------------ | ------------------------- | --------------------------------------------------------------------------- | ------------ |
34+
| target | DOM element or ref object | `Element` \| `Document` \| `(() => Element)` \| `MutableRefObject<Element>` | `document` |
35+
| shouldUpdate | Whether update position | `({ top: number, left: number }) => boolean` | `() => true` |
3636

3737
### Result
3838

packages/hooks/src/useScroll/index.zh-CN.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ const position = useScroll(target, shouldUpdate);
2929

3030
### Params
3131

32-
| 参数 | 说明 | 类型 | 默认值 |
33-
| ------------ | -------------------- | --------------------------------------------------------------------------- | ---------- |
34-
| target | DOM 节点或者 ref | `Element` \| `Document` \| `(() => Element)` \| `MutableRefObject<Element>` | `document` |
35-
| shouldUpdate | 控制是否更新滚动信息 | `({ top: number, left: number }) => boolean` | - |
32+
| 参数 | 说明 | 类型 | 默认值 |
33+
| ------------ | -------------------- | --------------------------------------------------------------------------- | ------------ |
34+
| target | DOM 节点或者 ref | `Element` \| `Document` \| `(() => Element)` \| `MutableRefObject<Element>` | `document` |
35+
| shouldUpdate | 控制是否更新滚动信息 | `({ top: number, left: number }) => boolean` | `() => true` |
3636

3737
### Result
3838

0 commit comments

Comments
 (0)