-
Notifications
You must be signed in to change notification settings - Fork 0
/
React
75 lines (57 loc) · 1.5 KB
/
React
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<input type="text"> </input>
<button onclick="createele()">Add</button>
</body>
<script>
function createele(){
const Value = document.querySelector("input").value;
const span = document.createElement("span"); // create a span tag
const button = document.createElement("button");
span.innerHTML = Value;
button.innerHTML = "Delete";
const div = document.createElement("div");
div.appendChild(span);
div.appendChild(button);
document.querySelector("body").appendChild(div);
}
</script>
</html>
// pros Handling
const Name = (props) => {
// const { frist,color } = props;
const {info}= props;
return (
// <p>{frist},{color}</p>
<p>I am {info.brand}</p>
);
}
export default Name;
// pros sent to another componet
import React from "react";
import Car from "./Car";
function App () {
const name = "hello World";
const color = "Black"
const info = {brand:'Redmi', Model : '15 pro Max'};
return (
// <Car frist = {name} color= {color} info/>
<Car info ={info} />
);
}
export default App;
// ternary operator used only in if else condtion
// && operator only used in if condition
lisiting
// Object using object unique Value
// array access index Value
useffect
no dependice = > every time run
[] = one time Run
[ value ] = Value Change after Run