Last active
November 5, 2017 18:30
-
-
Save Zabaa/ffb1764fb6da48b13641c1ec6db19ce7 to your computer and use it in GitHub Desktop.
React Redux component vscode snippet
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
{ | |
"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