Skip to content

Instantly share code, notes, and snippets.

@selfup
Created February 10, 2017 05:04
Show Gist options
  • Save selfup/4c8da13d065f8791cb6eba7f11f46dff to your computer and use it in GitHub Desktop.
Save selfup/4c8da13d065f8791cb6eba7f11f46dff to your computer and use it in GitHub Desktop.
class EmailField extends Component {
constructor() {
super();
this.state = {
email: '',
};
}
handleClick = (e) => {
this.props.dispatch('SOMETHING', { email: e.target.innerText }):
this.setState({ email: '' });
}
render() {
const { email } = this.state;
render (
<div>
<h1>Enter your email</h1>
<input
className="email-field"
value={email}
onClick={this.handleClick}
/>
</div>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment