Created
April 22, 2015 21:18
-
-
Save MiguelCastillo/82c8c50190085a30743a to your computer and use it in GitHub Desktop.
incorrect context in method `login`; the context is `window` instead of the instance of `Login`
This file contains 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'; | |
class Login extends React.Component { | |
render() { | |
return ( | |
<div className='Login'> | |
<input type='text' ref='username'></input><input type='password' ref='password'></input> | |
<button onClick={this.login}>Please Login</button> | |
</div> | |
); | |
} | |
login() { | |
var username = React.findDOMNode(this.refs.username).value.trim(); | |
var password = React.findDOMNode(this.refs.password).value.trim(); | |
console.log(username, password); | |
} | |
} | |
export default Login; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment