Skip to content

Commit

Permalink
docs: 更新useUpdated文档
Browse files Browse the repository at this point in the history
  • Loading branch information
llq0802 committed Oct 26, 2022
1 parent 6f97db7 commit e30175a
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
6 changes: 5 additions & 1 deletion .stylelintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
node_modules
dist
dist
docs-dist
es
lib

4 changes: 2 additions & 2 deletions packages/rc-use-hooks/src/usePrevious/demos/Demo2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Button, Input } from 'antd';
import { usePrevious } from 'rc-use-hooks';
import { useState } from 'react';

function Demo() {
function Demo2() {
const [count, setCount] = useState(0);
const [value, setValue] = useState('');
const prevValue = usePrevious(value);
Expand All @@ -21,4 +21,4 @@ function Demo() {
);
}

export default Demo;
export default Demo2;
4 changes: 2 additions & 2 deletions packages/rc-use-hooks/src/usePrevious/demos/demo1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Input } from 'antd';
import { usePrevious } from 'rc-use-hooks';
import { useState } from 'react';

function Demo() {
function Demo1() {
const [value, setValue] = useState('');
const prevValue = usePrevious(value);

Expand All @@ -20,4 +20,4 @@ function Demo() {
);
}

export default Demo;
export default Demo1;
4 changes: 2 additions & 2 deletions packages/rc-use-hooks/src/usePrevious/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ nav:

### 基础用法

<code src="./demos/demo1.tsx" />
<code src="./demos/demo1.tsx"/>

### 不受其他状态更新影响

<code src="./demos/demo2.tsx" />
<code src="./demos/demo2.tsx"/>

## API

Expand Down
2 changes: 1 addition & 1 deletion packages/rc-use-hooks/src/usePrevious/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function usePrevious<T>(state: T) {
}
return prevRef.current;
}

// 官方示例
// export default function usePrevious<T>(value: T): T {
// const ref = useRef<unknown | null>(null);
// useEffect(() => {
Expand Down

0 comments on commit e30175a

Please sign in to comment.