-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbind.html
More file actions
31 lines (29 loc) · 905 Bytes
/
bind.html
File metadata and controls
31 lines (29 loc) · 905 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>React</title>
</head>
<body>
<button>button clicked</button>
</body>
<script>
console.log("dr mashoor gulati is speaking");
class React {
constructor() {
this.library = "React";
this.server = "https://localhost:3000";
document
.querySelector("button")
.addEventListener("click", this.hadnleclick.bind(this));
}
hadnleclick() {
console.log("this button is clicked");
console.log(this); //before bind this present the context in which this calling wich means that button it return a button ..
//but after giving bind(this) this context change and it give us complete class ...
}
}
const app = new React();
</script>
</html>