Hello World

Hello World demo pulled from React Demystified

JSX


/** @jsx React.DOM */
var HelloMessage = React.createClass({
  render: function() {
    return <div>Hello {this.props.name}</div>;
  }
});
React.renderComponent(<HelloMessage name="Joe" />, document.querySelector('#output'));

Javascript


var HelloMessage = React.createClass({
  displayName: 'HelloMessage',
  render: function() {
    return React.DOM.div(null, "Hello ", this.props.name);
  }
});
React.renderComponent(HelloMessage({ name:"Joe" }), document.querySelector('#output'));

Output