Skip to content

Instantly share code, notes, and snippets.

@Zabaa
Last active November 5, 2017 18:30
Show Gist options
  • Save Zabaa/ffb1764fb6da48b13641c1ec6db19ce7 to your computer and use it in GitHub Desktop.
Save Zabaa/ffb1764fb6da48b13641c1ec6db19ce7 to your computer and use it in GitHub Desktop.
React Redux component vscode snippet
{
"ReactReduxComponent": {
"prefix": "rrcomp",
"body": [
"import React, { PropTypes } from 'react';\r",
"import { connect } from 'react-redux';\r",
"import { bindActionCreators } from 'redux';\r",
"\r",
"class ${1:ReactComponent} extends React.Component {\r",
" constructor(props, context) {\r",
" super(props, context);\r",
" \r",
" }\r",
" \r",
" render() {\r",
" return (\r",
" <div>\r",
"\r",
" </div>\r",
" );\r",
" }\r",
"}\r",
"\r",
"${1:ReactComponent}.propTypes = {\r",
" //myProp: PropTypes.string.isRequired",
"};\r",
"\r",
"function mapStateToProps(state, ownProps) {\r",
" return {\r",
" \r",
" };\r",
"}\r",
"\r",
"function mapDispatchToProps(dispatch) {\r",
" return {\r",
" actions: bindActionCreators(actions, dispatch)\r",
" };\r",
"}\r",
"\r",
"export default connect(mapStateToProps, mapDispatchToProps)(${1:ReactComponent});"
],
"description": "React Redux component"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment