|
|
@ -37,28 +37,23 @@ Example output: |
|
|
|
|
|
|
|
``` |
|
|
|
$ cat test.js |
|
|
|
var HelloMessage = React.createClass({ |
|
|
|
render: function() { |
|
|
|
return <div>Hello {this.props.name}</div>; |
|
|
|
} |
|
|
|
}); |
|
|
|
function HelloMessage(props) { |
|
|
|
return <div>Hello {props.name}</div>; |
|
|
|
} |
|
|
|
|
|
|
|
ReactDOM.render(<HelloMessage name="John" />, mountNode); |
|
|
|
|
|
|
|
$ babel test.js |
|
|
|
"use strict"; |
|
|
|
|
|
|
|
var HelloMessage = React.createClass({ |
|
|
|
displayName: "HelloMessage", |
|
|
|
|
|
|
|
render: function render() { |
|
|
|
return React.createElement( |
|
|
|
"div", |
|
|
|
null, |
|
|
|
"Hello ", |
|
|
|
this.props.name |
|
|
|
); |
|
|
|
} |
|
|
|
}); |
|
|
|
function HelloMessage(props) { |
|
|
|
return React.createElement( |
|
|
|
"div", |
|
|
|
null, |
|
|
|
"Hello ", |
|
|
|
props.name |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
ReactDOM.render(React.createElement(HelloMessage, { name: "John" }), mountNode); |
|
|
|
``` |
|
|
|