-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path02-jsx.html
35 lines (28 loc) · 1012 Bytes
/
02-jsx.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<div id="root"></div>
<script type="text/babel">
const rootElement = document.getElementById('root')
// const domElement = React.createElement(
// 'div', //element type
// {className: 'container', //props
// children: ['Hello World', 'Goodbye World']}, //props
// )
const string = 'Hello World'
const myClassName = 'container'
const props = {
className: 'container',
children: 'Hello World'
}
// const domElement = <div className="container">{ string }</div>
// const domElement = <div className={myClassName + '__hi-there'}>{ (() => string)() }</div>
// const domElement = (
// <div {...props} />
// )
const domElement = (
<div {...props} className="my-class" />
)
console.log(domElement)
ReactDOM.render(domElement, rootElement)
</script>