File tree Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Expand file tree Collapse file tree 3 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -12,11 +12,11 @@ const getPokemon = (id: number) =>
12
12
13
13
const Demo = ( ) => {
14
14
const counter = useCounter ( 1 ) ;
15
- const getPokemonQuery = useAsync ( ( ) => getPokemon ( counter . value ) , [ counter . value ] } ) ;
15
+ const getPokemonQuery = useAsync ( ( ) => getPokemon ( counter . value ) , [ counter . value ] ) ;
16
16
17
17
return (
18
18
< >
19
- < button type = 'button' disabled = { counter . count === 1 } onClick = { ( ) => counter . dec ( ) } >
19
+ < button type = 'button' disabled = { counter . value === 1 } onClick = { ( ) => counter . dec ( ) } >
20
20
Prev
21
21
</ button >
22
22
< button type = 'button' onClick = { ( ) => counter . inc ( ) } >
Original file line number Diff line number Diff line change @@ -21,12 +21,12 @@ const Demo = () => {
21
21
flexDirection : 'column' ,
22
22
justifyContent : 'center' ,
23
23
alignItems : 'center' ,
24
- border : `1px solid ${ counter . count < 5 ? 'red' : 'green' } `
24
+ border : `1px solid ${ counter . value < 5 ? 'red' : 'green' } `
25
25
} }
26
26
>
27
27
< p > Click more than 5 times:</ p >
28
28
< p >
29
- < code > { counter . count } </ code >
29
+ < code > { counter . value } </ code >
30
30
</ p >
31
31
</ div >
32
32
) ;
Original file line number Diff line number Diff line change @@ -3,16 +3,16 @@ import { useCounter } from '../useCounter/useCounter';
3
3
import { usePageLeave } from './usePageLeave' ;
4
4
5
5
const Demo = ( ) => {
6
- const { count , inc } = useCounter ( 0 ) ;
6
+ const counter = useCounter ( 0 ) ;
7
7
8
- const isLeft = usePageLeave ( ( ) => inc ( ) ) ;
8
+ const isLeft = usePageLeave ( ( ) => counter . inc ( ) ) ;
9
9
10
10
return (
11
11
< >
12
12
< p >
13
13
Mouse left the page: < code > { String ( isLeft ) } </ code >
14
14
</ p >
15
- < p > Count of left the page { count } times</ p >
15
+ < p > Count of left the page { counter . value } times</ p >
16
16
</ >
17
17
) ;
18
18
} ;
You can’t perform that action at this time.
0 commit comments