1//Below I use the React.createElement() function to create a virtual DOM
2//representation of a <li> element node containing a text node of one (a.k.a.,
3//React text) and an id of li1.
4
5var reactNodeLi = React.createElement('li', {id:'li1'}, 'one');
6
7
1class Hello extends React.Component {
2 render() {
3 return React.createElement('div', null, `Hello ${this.props.toWhat}`);
4 }
5}
6
7ReactDOM.render(
8 React.createElement(Hello, {toWhat: 'World'}, null),
9 document.getElementById('root')
10);
1const e = React.createElement;
2
3ReactDOM.render(
4 e('div', null, 'Hello World'),
5 document.getElementById('root')
6);
1class Greeting extends React.Component {
2 render() {
3 return <h1>Hello, {this.props.name}</h1>;
4 }
5}