-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp_old.js
More file actions
36 lines (26 loc) · 945 Bytes
/
app_old.js
File metadata and controls
36 lines (26 loc) · 945 Bytes
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
import React from "react";
import ReactDOM from "react-dom/client";
// STEP 1. Find the root element on the DOM where you want to run the React library
let root = document.getElementById("root");
// STEP 2. Create a HTML element dynamically and store it in a var
// createElement takes 2
let span = React.createElement("span", {id:"halwa", key:"ij"}, "span text");
const element = React.createElement(
"h1",
null,
"Hello My name is ",
React.createElement("span", null, "Mrinal"),
" Jain"
);
let headingOne = React.createElement("h1", {}, "Hello world...!");
let headingTwo = React.createElement("h2", {}, "Hello world once again");
// Example for createElement
let div = React.createElement("div", { className: "halwa", id: "puri" }, [
headingOne,
headingTwo,
element,
]);
// STEP : Tell react about your react ROOT on DOM
let dom = ReactDOM.createRoot(root);
dom.render(span);
var image = React.createElement("img");