<main id="app"></main>
var container = document.getElementById('app');
var h = React.createElement;
Hello.prototype = Object.create(React.Component.prototype);
function Hello() {
React.Component.constructor.call(this);
this.state = { message: 'hello' };
this.componentWillMount = function() {
console.log('Look in the console');
this.props.children.property('hello');
};
this.render = function() {
return h('div', {}, this.state.message + ' ' + this.props.text);
};
};
var anything = {
property: function(greet) {
console.log(greet + ' from a property in anything');
}
};
var HelloElement = h(Hello, { text: 'World' }, anything);
var HelloContainer = h('h1', {}, HelloElement);
var App = h('div', { children: HelloContainer });
ReactDOM.render(App, container);
This Pen doesn't use any external CSS resources.