Skip to content

Instantly share code, notes, and snippets.

@whtswrng
Last active October 15, 2018 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whtswrng/0ba3bfc789bf65b70ffebc5fb414f352 to your computer and use it in GitHub Desktop.
Save whtswrng/0ba3bfc789bf65b70ffebc5fb414f352 to your computer and use it in GitHub Desktop.
react-testing-3.js
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