Created
November 24, 2018 04:44
-
-
Save Joe1220/f27c10abad5eb8082072ef069d0ca963 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, { Component } from 'react'; | |
import { observable, action } from 'mobx' | |
import { observer } from 'mobx-react' | |
import "./Login.css" | |
@observer | |
class Login extends Component { | |
@observable email = '' | |
@observable passwords = '' | |
constructor(props) { | |
super(props) | |
this.onSubmit = this.onSubmit.bind(this) | |
} | |
render() { | |
const { email, password } = this | |
return ( | |
<div className="App"> | |
<header>Login</header> | |
<input name="email" placeholder="Email" onChange={this.onChange} value={email} fluid /> | |
<input | |
name="password" | |
type="password" | |
placeholder="Password" | |
onChange={this.onChange} | |
value={password} | |
fluid | |
/> | |
<button onClick={this.onSubmit}>Submit</button> | |
</div> | |
); | |
} | |
@action.bound | |
onChange(event) { | |
const { name, value } = event.target; | |
this[name] = value; | |
} | |
onSubmit() { | |
const { email, password } = this | |
console.log('결과확인 : ', email, password); | |
} | |
} | |
export default Login; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment