React
by Huynh Ha
HTML
<div id="root"></div>
<div id="root2"></div>
CSS
body {
padding : 20px
}
React
// Function way
const E5 = props => React.createElement(
'div',
null,
props.name
);
const e5 = E5({ name: 'taylor' });
ReactDOM.render(e5, document.getElementById('root'));
// Class Component Way
class E6 extends React.Component {
render() {
return React.createElement(
"div",
null,
this.props.name
);
}
}
const e6 = React.createElement(E6, { name: "taylor" });
ReactDOM.render(e6, document.getElementById('root2'));