-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
53 lines (26 loc) · 1.18 KB
/
App.js
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import React from 'react'
import ReactDOM from 'react-dom';
//React Element
const heading = React.createElement('h1',{id:'heading',class:'head'},'Hello world from React')
//Functional Component
const HeadingFunctional1=()=> <h1>Hello from Functional component without return</h1>
//Component composition - componenet under component
const HeadingFunctional=()=>{
return <div>
{heading}
<HeadingFunctional1/>
<h1>Hello from Functional component</h1>
</div>
}
const root=ReactDOM.createRoot(document.getElementById('root'));
root.render(<HeadingFunctional/>);
// const parent=React.createElement('div',{id:'parent'},
// React.createElement('div',{id:'child'},
// React.createElement('h1',{},'H1 tag')));
// const parent=React.createElement('div',{id:'parent'},
// [React.createElement('div',{id:'child'},
// [React.createElement('h1',{},'H1 tag'),React.createElement('h2',{},'H2 tag')]),
// React.createElement('div',{id:'child'},
// [React.createElement('h1',{},'H1 tag'),React.createElement('h2',{},'H2 tag')])]);
// const root=ReactDOM.createRoot(document.getElementById('root'));
// root.render(parent);