ReactDOM.render(
<h1>Hello, world!</h1>,
document.getElementById('root')
);
let h1 = React.createElement('h1', null, 'Hello World');
ReactDOM.render(
React.createElement('div', null, h1, h1),
document.getElementById('root')
);
class HelloWorld extends React.Component {
render() {
return React.createElement('h1', null, 'Hello, World!')
}
}
ReactDOM.render(
React.createElement(
'div',
null,
React.createElement(HelloWorld),
React.createElement(HelloWorld)
),
document.getElementById('root')
);
class HelloWorld extends React.Component {
render() {
console.log(this.props);
return React.createElement('h1', null, `Hello ${this.props.name}`)
}
}
ReactDOM.render(
React.createElement(
'div',
null,
React.createElement(HelloWorld, { name: 'kim' }),
React.createElement(HelloWorld, { name: 'yoon'})
),
document.getElementById('root')
);
class HelloWorld extends React.Component {
render() {
console.log(this.props);
return (
<h1>Hello {this.props.name}</h1>
)
}
}
ReactDOM.render(
<div>
<HelloWorld name='kim' />
<HelloWorld name='yoon' />
</div>,
document.getElementById('root')
);