-
Notifications
You must be signed in to change notification settings - Fork 0
/
Statechange.js
29 lines (27 loc) · 1.06 KB
/
Statechange.js
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
import React, { Component } from 'react'
export default class Statechange extends Component {
constructor(){
super();
this.state={ReadMe:false};
this.ChangeReadMore=this.ChangeReadMore.bind(this);
}
ChangeReadMore(){
this.setState({ReadMe: !this.state.ReadMe})
}
render() {
return (
<div>
<h2>This is a hidden para for class state and binding purppose .</h2>
{
this.state.ReadMe?
(
<div>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Aut pariatur ratione modi qui, totam quas vitae, at quae, explicabo dicta aliquid harum corporis incidunt porro odit ducimus sequi fuga. Excepturi.</p>
<button onClick={this.ChangeReadMore}>See less</button>
</div>
):<button onClick={this.ChangeReadMore}>See More</button>
}
</div>
)
}
}