//Trong ES5
var Greeting = React.createClass({
render: function() {
return React.createElement("p", null, "Hello, Universe");
},
});
ReactDOM.render(
React.createElement(Greeting),
document.getElementById('greeting-div')
);
//Hoặc trong ES6
class Greeting extends React.Component {
render() {
return React.createElement("p", null, "Hello, Universe");
}
}
ReactDOM.render(
React.createElement(Greeting),
document.getElementById('greeting-div')
);