-
Notifications
You must be signed in to change notification settings - Fork 29
/
Copy pathApp.js
52 lines (43 loc) · 1.1 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
// # Namaste React 🚀
/*
# Parcel
- Dev Build
- Local Server
- HMR = Hot Module Replacement
- File Watching Algorithm - written in C++
- Caching - Faster Builds
- Image Optimization
- Minification
- Bundling
- Compress
- Consistent Hashing
- Code Splitting
- Differential Bundling - support older browsers
- Diagnostic
- Error Handling
- HTTPs
- Tree Shaking - remove unused code
- Different dev and prod bundles
*/
import React from "react";
import ReactDOM from "react-dom/client";
const child1 = React.createElement("div", { id: "child1" }, [
React.createElement("h1", {}, "This is Namaste React 🚀"),
React.createElement("h2", {}, "by Akshay Saini"),
]);
const child2 = React.createElement("div", { id: "child2" }, [
React.createElement("h1", {}, "I am an h1 tag"),
React.createElement("h2", {}, "I am an h2 tag"),
]);
const parent = React.createElement(
"div",
{
id: "parent"
},
[child1, child2]
);
// console.log(parent); // object
// create root using createRoot
const root = ReactDOM.createRoot(document.getElementById("root"));
// passing react element inside root
root.render(parent);