Skip to content

Instantly share code, notes, and snippets.

@0xF013
Last active September 22, 2016 11:22
Show Gist options
  • Save 0xF013/5c8c420b7ba7742dfc5520e1d7f1280e to your computer and use it in GitHub Desktop.
Save 0xF013/5c8c420b7ba7742dfc5520e1d7f1280e to your computer and use it in GitHub Desktop.
// import react, etc
import { beginRegistration } from 'actions/registration';
export RegistrationButton extends Component {
propTypes = {
text: PropTypes.string.isRequired,
beginRegistration: PropTypes.func.isRequired
};
render() {
const { text, beginRegistration } = this.props;
return (<button onClick={beginRegistration}>{text}</button>);
}
}
const mapStateToProps = state => ({text: state.registrationText });
const mapDispatchToProps = dispatch => ({
beginRegistration() {
dispatch(beginRegistration());
}
});
export default connect(mapStateToProps, mapDispatchToProps)(RegistrationButton);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment