-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
62 lines (44 loc) · 1.63 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
54
55
56
57
58
59
60
61
62
// NAMASTE REACT IN REACT
//0
const head = React.createElement('h1', {}, "Namaste React in React")
//01
const heading = React.createElement(
'h1',
{id: "head", className: "heading", abc: "xyz"},
"Namaste React from React"
);
const heading2 = React.createElement(
'h2',
{id: "head2", className: "heading2", abc: "xyz"},
"Namaste React from React2"
);
const con = React.createElement('div',{id:"con"}, heading);
console.log(con)
// const root = ReactDOM.createRoot(document.getElementById("root"))
// root.render(con)
//02 . Create this structure using React
// <div id="container">
// <div id="child1">
// <h1></h1>
// <h2>I am first h2</h2>
// </div>
// <div id="child2">
// <h1>I am second h1</h1>
// <h2>I am second h2</h2>
// </div>
// </div>
const container = React.createElement(
'div',
{id: "container"},[
React.createElement('div', {id: "child1"},[
React.createElement('h1', {}, "I am first h1"),
React.createElement('h1', {}, "I am first h2"),
])],[
React.createElement('div', {id: "child2"},[
React.createElement('h1', {}, "I am second h1"),
React.createElement('h1', {}, "I am second h2"),
])]
)
console.log(container);
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(container)