Skip to content

Instantly share code, notes, and snippets.

@hungtrn75
Last active June 7, 2019 05:07
Show Gist options
  • Save hungtrn75/dee95a26fb58782a00384790769df116 to your computer and use it in GitHub Desktop.
Save hungtrn75/dee95a26fb58782a00384790769df116 to your computer and use it in GitHub Desktop.
{
"Import React-Redux": {
"prefix": "importReactRedux",
"body": [
"import { connect } from 'react-redux';",
"import { bindActionCreators, compose } from 'redux';"
],
"description": "Import react-redux"
},
"mapStateToProps": {
"prefix": "mapStateToProps",
"body": [
"const mapStateToProps = state => ({",
"\t${2:State}: state.${1:reducer}.${2:State}",
"});"
],
"description": "mapStateToProps"
},
"mapDispatchToProps": {
"prefix": "mapDispatchToProps",
"body": [
"const mapDispatchToProps = dispatch =>",
"\tbindActionCreators(",
"\t\t{",
"\t\t\t${2:spec}: ${1:Actions}.${2:spec},",
"\t\t},",
"\t\tdispatch",
"\t);"
],
"description": "mapDispatchToProps"
},
"constructor": {
"prefix": "constructor",
"body": [
"constructor(props) {",
"\tsuper(props);",
"\tthis.state = {${1:State}};",
"}"
],
"description": "constructor"
},
"compose": {
"prefix": "compose",
"body": [
"compose(",
"\tconnect(",
"\t\tmapStateToProps,",
"\t\tmapDispatchToProps",
"\t),",
"\t${1:HOC}",
")(${2:Component});"
],
"description": "compose"
},
"importStorage": {
"prefix": "importStorage",
"body": [
"import AsyncStorage from '@react-native-community/async-storage';"
],
"description": "importStorage"
},
"dimentions": {
"prefix": "dimentions",
"body": ["const { width, height } = Dimensions.get('window');"],
"description": "dimentions"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment