File tree Expand file tree Collapse file tree 1 file changed +7
-15
lines changed Expand file tree Collapse file tree 1 file changed +7
-15
lines changed Original file line number Diff line number Diff line change @@ -11,27 +11,21 @@ class Button extends React.Component {
11
11
render () {
12
12
return (
13
13
< button style= {{background: this .context .color }}>
14
- {this .props .text }
14
+ {this .props .children }
15
15
< / button>
16
16
);
17
17
}
18
18
}
19
- Button .propTypes = {
20
- text: React .PropTypes .string
21
- };
22
19
Button .contextTypes = {
23
20
color: React .PropTypes .string
24
21
};
25
22
```
26
23
27
24
``` jsx
28
- const Button = ({text} , context ) =>
25
+ const Button = (props , context ) =>
29
26
< button style= {{background: context .color }}>
30
- {text }
27
+ {props . children }
31
28
< / button> ;
32
- Button .propTypes = {
33
- text: React .PropTypes .string
34
- };
35
29
Button .contextTypes = {
36
30
color: React .PropTypes .string
37
31
};
@@ -44,24 +38,22 @@ class Button extends React.Component {
44
38
render () {
45
39
return (
46
40
< button style= {{background: this .props .color }}>
47
- {this .props .text }
41
+ {this .props .children }
48
42
< / button>
49
43
);
50
44
}
51
45
}
52
46
Button .propTypes = {
53
- text: React .PropTypes .string ,
54
47
color: React .PropTypes .string
55
48
};
56
49
```
57
50
58
51
``` jsx
59
- const Button = ({text, color} ) =>
60
- < button style= {{background: color}}>
61
- {text }
52
+ const Button = (props ) =>
53
+ < button style= {{background: props . color }}>
54
+ {props . children }
62
55
< / button> ;
63
56
Button .propTypes = {
64
- text: React .PropTypes .string ,
65
57
color: React .PropTypes .string
66
58
};
67
59
```
You can’t perform that action at this time.
0 commit comments