Skip to content

Instantly share code, notes, and snippets.

@betiol
Created August 20, 2016 19:42
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 betiol/2b9fcafb319122d910b260a4eca2b9e3 to your computer and use it in GitHub Desktop.
Save betiol/2b9fcafb319122d910b260a4eca2b9e3 to your computer and use it in GitHub Desktop.
React Redux Container Component
import React, {PropTypes} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
class $NAME extends React.Component {
constructor(props, context) {
super(props, context);
}
render() {
return (
);
}
}
$NAME .propTypes = {
//myProp: PropTypes.string.isRequired
};
function mapStateToProps(state, ownProps) {
return {
state: state
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators(actions,dispatch)
};
}
export default connect(mapStateToProps, mapDispatchToProps)($NAME);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment