File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ class ControlPanel extends Component {
10
10
render ( ) {
11
11
return (
12
12
< div style = { style } >
13
- < Counter caption = "First" initValue = { 0 } />
13
+ < Counter caption = "First" foo />
14
14
< Counter caption = "Second" initValue = { 10 } />
15
15
< Counter caption = "Third" initValue = { 20 } />
16
16
</ div >
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class Counter extends Component {
13
13
this . onClickDecrementButton = this . onClickDecrementButton . bind ( this ) ;
14
14
15
15
this . state = {
16
- count : props . initValue || 0
16
+ count : props . initValue
17
17
}
18
18
}
19
19
@@ -37,5 +37,14 @@ class Counter extends Component {
37
37
}
38
38
}
39
39
40
+ Counter . propTypes = {
41
+ caption : PropTypes . string . isRequired ,
42
+ initValue : PropTypes . number
43
+ } ;
44
+
45
+ Counter . defaultProps = {
46
+ initValue : 0
47
+ } ;
48
+
40
49
export default Counter ;
41
50
You can’t perform that action at this time.
0 commit comments