Created
May 7, 2019 10:33
-
-
Save Mayankgupta688/aa27dff6a0a057424b829a86cfce9f72 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class EmployeeDetails extends React.Component { | |
| constructor() { | |
| super(); | |
| this.state = { | |
| name: "Mayank", | |
| age: 31, | |
| designation: "Senior Developer" | |
| } | |
| } | |
| updateEmployeeAge = () => { | |
| this.setState({ | |
| age: this.state.age + 1 | |
| }); | |
| } | |
| render() { | |
| return ( | |
| <div> | |
| <p>Employee Name: {this.state.name}</p> | |
| <p>Employee Age: {this.state.name}</p> | |
| <p>Employee Designation: {this.state.designation}</p> | |
| <input type="button" onClick={this.updateEmployeeAge} value="Click To Update Age" /> | |
| </div> | |
| ) | |
| } | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment