-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
109 lines (93 loc) · 2.15 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// const heading = React.createElement(
// "h1",
// { id: "heading", xyz: "abcs" },
// "Hello World! by React bhaiya"
// );
// const root = ReactDOM.createRoot(document.getElementById("root"));
// root.render(heading);
// console.log(heading) it will returns as a object
// {id: "heading", xyz : "abcs"} props
// ---------------------------------------------------------
// nested Element in React
/*
*
*
<div id="parent">
<div id="child">
<h1></h1>
</div>
</div>
*
*
* ReactElement(Object) => HTML(Browser understands)
*
*/
// const parent = React.createElement(
// "div",
// { id: "parent" },
// React.createElement(
// "div",
// { id: "child" },
// React.createElement("h1", {}, "I'm H1 tag")
// )
// );
// console.log(parent);
// const root = ReactDOM.createRoot(document.getElementById("root"));
// root.render(parent);
/*
*siblings
*
<div id="parent">
<div id="child">
<h1>I'm H1 tag</h1>
<h2>I'm H2 tag</h2>
</div>
</div>
*
*
*
* */
// const parent = React.createElement(
// "div",
// { id: "parent" },
// React.createElement("div", { id: "child" }, [
// React.createElement("h1", {}, "I'm H1 tag"),
// React.createElement("h2", {}, "I'm H2 tag"),
// ])
// );
// console.log(parent);
// const root = ReactDOM.createRoot(document.getElementById("root"));
// root.render(parent);
/*
*
*
<div id="parent">
<div id="child1">
<h1>I'm H1 tag</h1>
<h2>I'm H2 tag</h2>
</div>
<div id="child2">
<h1>I'm H1 tag</h1>
<h2>I'm H2 tag</h2>
</div>
</div>
*
*
*
* */
// core of react
import React from "react";
import ReactDOM from "react-dom/client";
const parent = React.createElement("div", { id: "parent" }, [
React.createElement("div", { id: "child1" }, [
React.createElement("h1", {}, "This is namaste React"),
React.createElement("h2", {}, "I'm mohil kumar"),
]),
React.createElement("div", { id: "child" }, [
React.createElement("h1", {}, "I'm H sfsf 3tag"),
React.createElement("h2", {}, "I'm H2 tag"),
]),
]);
const root = ReactDOM.createRoot(document.getElementById("root"));
root.render(parent);
//JSX