Skip to content

Instantly share code, notes, and snippets.

@lorenzoongithub
Created July 6, 2015 19:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lorenzoongithub/840bd3b0c6b1ee3af95a to your computer and use it in GitHub Desktop.
Save lorenzoongithub/840bd3b0c6b1ee3af95a to your computer and use it in GitHub Desktop.
react.js
//
// hello world in react.js
//
load('https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js');
element = document.createElement('div');
HelloMessage = React.createClass({displayName: 'HelloMessage',
render: function() {
return React.createElement('element', null, 'Hello ', this.props.name);
}
});
oj = {name: 'World'};
React.render(React.createElement(HelloMessage, oj), element );
text = element.textContent || element.innerText;
if (text != 'Hello World') throw '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment