-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.jsx
More file actions
79 lines (58 loc) · 2.02 KB
/
index.jsx
File metadata and controls
79 lines (58 loc) · 2.02 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
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
76
77
78
79
import React from 'react';
import ReactDom from 'react-dom';
import './style/style.css'
import {BrowserRouter as Router, Route, Link } from 'react-router-dom';
class Child extends React.Component {
render(){
return <b>This is text from child component </b>
}
}
class Users extends React.Component {
render(){
/*return <div>
<h1>{this.props.myName}</h1>
<button onClick = {this.props.myFunction}>check</button>
</div>*/
return <div><h1>this is user component</h1>
<h2>ohh wah chal gea</h2>
</div>
}
}
class AppComponent extends React.Component {
constructor(){
super();
this.state = {
color: 'green-color'
};
this.sayhellow = this.sayhellow.bind(this);
this.name = 'Muhammad Tahir';
}
performAction(){
alert('this is users component');
}
sayhellow(){
// alert("Neeche show Ho Raha Mera Component gereen main.")
this.state.color = 'yellow-color';
this.setState(this.state);
}
render(){
/*return <div>
<Child/>
<button onClick={this.sayhellow.bind(this)}>My New Component</button>
<button onClick={()=>this.sayhellow()}>My New Component</button>
<h1 className="province">This is our 1st Component</h1>
<h1 className={this.state.color}>This is our 1st Component</h1>
</div>*/
return <Router>
{/*<div>
<ABCD myName = {this.name} myFunction = {this.performAction}/>
</div>*/}
<div>
<div>This is Home Page</div>
<Link to = "/users">Users Page</Link>
<Route path = "/users" component = {Users} />
</div>
</Router>
}
}
ReactDom.render(<AppComponent />, document.getElementById('rootElement'));