-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDOM.html
More file actions
50 lines (48 loc) · 1.73 KB
/
DOM.html
File metadata and controls
50 lines (48 loc) · 1.73 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Intro</title>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
</head>
<body>
<div id="app"></div>
<!-- class cannot be added in js bcz its reserved keyword in javascript-->
<script type="text/babel">
class App extends React.Component{
state = {
name : "Abhishek",
age : 30
}
handleOnClick(e)
{
console.log(e.target);
}
handleMouseOver(e)
{
console.log(e.target,e.pageX);
}
handleCopy(e)
{
console.log("Once you copy you cannot learn!!")
}
render() {
return (
<div className="app-content">
<h1> Hey, yay!</h1>
<p> My name is {this.state.name} and i am {this.state.age} years
old</p>
<button onClick={this.handleOnClick}>Click Me</button>
<button onMouseOver={this.handleMouseOver}>Hover Me</button>
<p onCopy={this.handleCopy}>Helloe this is confidential</p>
</div>
)
}
}
ReactDOM.render(<App/>, document.getElementById('app'))
</script>
</body>
</html>