Last active
October 15, 2018 20:02
-
-
Save whtswrng/0ba3bfc789bf65b70ffebc5fb414f352 to your computer and use it in GitHub Desktop.
react-testing-3.js
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
export class Subscription extends Component { | |
state = { | |
email: '' | |
}; | |
render() { | |
return ( | |
<input | |
id="email" | |
type="email" | |
onChange={(data) => this.onEmailChange(data.value)} | |
/> | |
<input id="submit" type="submit" onSubmit={() => this.onSubmit()}/> | |
) | |
} | |
onEmailChange(email) { | |
this.setState({email}); | |
} | |
onSubmit() { | |
this.props.subcribe({email: this.state.email}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment