Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: usePrevious #154

Merged
merged 4 commits into from
Nov 18, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: remove unnecessary code
  • Loading branch information
ttys026 committed Nov 18, 2019
commit 9fc2e7c0da47e84de5d35829b556b74d93bab829
1 change: 0 additions & 1 deletion src/usePrevious/demo/demo1.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import usePrevious from '..';
export default () => {
const [count, setCount] = useState(0);
const previous = usePrevious(count);
console.log('in demo', previous);
return (
<>
<div>counter current value: {count}</div>
Expand Down
3 changes: 0 additions & 3 deletions src/usePrevious/demo/demo1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ import usePrevious from '..';
export default () => {
const [count, setCount] = useState(0);
const previous = usePrevious(count);

console.log('in demo', previous);

return (
<>
<div>counter current value: {count}</div>
Expand Down
6 changes: 2 additions & 4 deletions src/usePrevious/demo/demo2.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ export default () => {
setState(s => ({ ...s, name: nameInput }));
}}
>
{' '}
update{' '}
update
</Button>
</Input.Group>
<Input.Group
Expand All @@ -91,8 +90,7 @@ export default () => {
setState(s => ({ ...s, job: jobInput }));
}}
>
{' '}
update{' '}
update
</Button>
</Input.Group>
</>
Expand Down
6 changes: 2 additions & 4 deletions src/usePrevious/demo/demo2.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ export default () => {
setState(s => ({ ...s, name: nameInput }));
}}
>
{' '}
update{' '}
update
</Button>
</Input.Group>
<Input.Group compact style={{ marginTop: 16 }}>
Expand All @@ -75,8 +74,7 @@ export default () => {
setState(s => ({ ...s, job: jobInput }));
}}
>
{' '}
update{' '}
update
</Button>
</Input.Group>
</>
Expand Down
4 changes: 2 additions & 2 deletions src/usePrevious/index_cn.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ const previousState: T = usePrevious<T>(
);
```

### 结果
### Result

| 参数 | 说明 | 类型 |
|------|----------|------|
| previousState | 上次 state 的值 | T |

### 参数
### Params

| 参数 | 说明 | 类型 | 默认值 |
|---------|----------|------------------------|--------|
Expand Down