Created
May 16, 2017 12:38
-
-
Save tomanagle/a318a8dc07913e28f71c4b6e79e548aa to your computer and use it in GitHub Desktop.
React Redux Container Component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {PropTypes, Component} from 'react'; | |
import {bindActionCreators} from 'redux'; | |
import {connect} from 'react-redux'; | |
class $NAME extends Component { | |
constructor(props, context) { | |
super(props, context); | |
} | |
componentDidMount() { | |
document.title = $NAME; | |
} | |
render() { | |
return ( | |
<div> | |
<h1>$NAME</h1> | |
</div> | |
); | |
} | |
} | |
$NAME.propTypes = { | |
//MyProps : PropTypes.objct.isRequired | |
}; | |
//Return your props : state | |
function mapStateToProps(state, ownProps) { | |
return {}; | |
} | |
// Bind action creators | |
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
Code Template for WebStorm.
File > Settings > Editor > File and Code Templates > Green plus