Skip to content

Instantly share code, notes, and snippets.

@whtswrng
Last active October 20, 2018 20:21
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/719e0cf1cac709784d34bcd3d483e5d6 to your computer and use it in GitHub Desktop.
Save whtswrng/719e0cf1cac709784d34bcd3d483e5d6 to your computer and use it in GitHub Desktop.
react-testing-4.js
export class Subscription extends Component {
state = {
email: ''
};
render() {
return (
...
<MarketingContent logo={logo}/>
<EmailInput onChange={(email) => this.onEmailChange(email)}/>
<SubmitButton 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