Skip to content

Commit 49a1ae9

Browse files
committed
docs: refine README usage and ecosystem note
1 parent d240e64 commit 49a1ae9

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

README.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,10 @@
11
<div align="center">
22
<h1>@rc-component/mutate-observer</h1>
3+
<p><sub>Part of the Ant Design ecosystem.</sub></p>
34
<img alt="Ant Design" height="32" src="https://gw.alipayobjects.com/zos/bmw-prod/ae669a89-0c24-40ff-a91d-2b83497170f6.svg" />
45
<p>👁️ React wrapper and hook for observing DOM mutations with a typed MutationObserver API.</p>
56
</div>
67

7-
<p align="center">
8-
<sub>
9-
<a href="https://ant.design">
10-
<img alt="Ant Design" src="https://gw.alipayobjects.com/zos/rmsportal/KDpgvguMpGfqaHPjicRK.svg" height="16">
11-
</a>
12-
Part of the Ant Design ecosystem.
13-
</sub>
14-
</p>
158

169
<div align="center">
1710

@@ -53,8 +46,6 @@ npm install @rc-component/mutate-observer
5346

5447
```tsx | pure
5548
import MutateObserver from '@rc-component/mutate-observer';
56-
import React from 'react';
57-
5849
export default () => (
5950
<MutateObserver
6051
options={{ attributes: true, childList: true, subtree: true }}
@@ -70,16 +61,13 @@ export default () => (
7061

7162
```tsx | pure
7263
import { useMutateObserver } from '@rc-component/mutate-observer';
73-
import React, { useState } from 'react';
74-
75-
export default () => {
76-
const [target, setTarget] = useState<HTMLDivElement | null>(null);
7764

65+
export default ({ target }: { target: HTMLDivElement | null }) => {
7866
useMutateObserver(target, mutations => {
7967
console.log(mutations);
8068
});
8169

82-
return <div ref={setTarget}>Observed content</div>;
70+
return <div>Observed content</div>;
8371
};
8472
```
8573

0 commit comments

Comments
 (0)