Last active
February 7, 2019 13:36
-
-
Save krishankant/525936c2938f1cf3d892db2cfa017b3c 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
| import React from 'react'; | |
| export default class Login extends React.Component{ | |
| constructor() { | |
| super() | |
| this.state = { | |
| username: '', | |
| password: '', | |
| isLogined: false | |
| } | |
| } | |
| handleInputChange = (event) => { | |
| this.setState({ | |
| [event.target.name]: event.target.value | |
| }) | |
| } | |
| submitClick=() => | |
| { | |
| if((this.state.username=="krishankantsinghal") && (this.state.password=="krishankant123")) | |
| { | |
| this.setState({isLogined:true}); | |
| } | |
| } | |
| render() | |
| { | |
| return ( | |
| <div> | |
| <input type="text" name="username" hint="username" onChange={this.handleInputChange} /> | |
| <input type="password" name="password" hint="password" onChange={this.handleInputChange} /> | |
| <button name="submit" onClick={this.submitClick}> Submit</button> | |
| </div> | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment