File tree Expand file tree Collapse file tree 3 files changed +3
-6
lines changed Expand file tree Collapse file tree 3 files changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -8,16 +8,13 @@ export class Counter extends Component {
8
8
optional : true ,
9
9
} ,
10
10
} ;
11
- static defaultProps = {
12
- callback : ( ) => { } ,
13
- } ;
14
11
15
12
setup ( ) {
16
13
this . state = useState ( { value : 0 } ) ;
17
14
}
18
15
19
16
increment ( ) {
20
17
this . state . value ++ ;
21
- this . props . callback ( ) ;
18
+ this . props . callback ?. ( ) ;
22
19
}
23
20
}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ export class Todo {
5
5
this . isCompleted = false ;
6
6
}
7
7
8
- setCompletion ( isCompleted ) {
8
+ setIsCompleted ( isCompleted ) {
9
9
this . isCompleted = isCompleted ;
10
10
}
11
11
}
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ export class TodoList extends Component {
25
25
26
26
toggleState ( id ) {
27
27
const todo = this . todos . find ( t => t . id === id ) ;
28
- if ( todo ) todo . setCompletion ( ! todo . isCompleted ) ;
28
+ if ( todo ) todo . setIsCompleted ( ! todo . isCompleted ) ;
29
29
}
30
30
31
31
removeTodo ( id ) {
You can’t perform that action at this time.
0 commit comments