File tree Expand file tree Collapse file tree 1 file changed +11
-14
lines changed Expand file tree Collapse file tree 1 file changed +11
-14
lines changed Original file line number Diff line number Diff line change 7
7
< script type ="text/babel ">
8
8
const rootElement = document . getElementById ( 'root' )
9
9
10
- class SayHello extends React . Component {
11
- static propTypes = {
12
- firstName : PropTypes . string . isRequired ,
13
- lastName : PropTypes . string . isRequired ,
14
- }
10
+ function SayHello ( { firstName, lastName} ) {
11
+ return (
12
+ < div >
13
+ Hello { firstName } { lastName } !
14
+ </ div >
15
+ )
16
+ }
15
17
16
- render ( ) {
17
- const { firstName, lastName} = this . props
18
- return (
19
- < div >
20
- Hello { firstName } { lastName } !
21
- </ div >
22
- )
23
- }
18
+ SayHello . propTypes = {
19
+ firstName : PropTypes . string . isRequired ,
20
+ lastName : PropTypes . string . isRequired ,
24
21
}
25
22
26
- const element = < SayHello firstName = "Jojo " lastName = "Potatoes " />
23
+ const element = < SayHello firstName = "Sonic " lastName = "The Hedgehog " />
27
24
28
25
ReactDOM . render ( element , rootElement )
29
26
</ script >
You can’t perform that action at this time.
0 commit comments