Skip to content

Instantly share code, notes, and snippets.

@eowfenth
Forked from lucianomlima/snippets.cson
Created August 28, 2017 15:57
Show Gist options
  • Select an option

  • Save eowfenth/6709ffe0296fc1ad534de684e9f3707e to your computer and use it in GitHub Desktop.

Select an option

Save eowfenth/6709ffe0296fc1ad534de684e9f3707e to your computer and use it in GitHub Desktop.
React Native Atom snippets
{
".source.js":
"React: componentDidMount() { ... }":
prefix: "cdm"
body: "componentDidMount() {\n\t${1}\n}"
"React: componentDidUpdate(pp, ps) { ... }":
prefix: "cdup"
body: "componentDidUpdate(prevProps, prevState) {\n\t${1}\n}"
"React: componentWillMount() { ... }":
prefix: "cwm"
body: "componentWillMount() {\n\t${1}\n}"
"React: componentWillReceiveProps(np) { ... }":
prefix: "cwrp"
body: "componentWillReceiveProps(nextProps) {\n\t${1}\n}"
"React: componentWillUnmount() { ... }":
prefix: "cwun"
body: "componentWillUnmount() {\n\t${1}\n}"
"React: componentWillUpdate(np, ns) { ... }":
prefix: "cwup"
body: "componentWillUpdate(nextProps, nextState) {\n\t${1}\n}"
"React: shouldComponentUpdate(np, ns) { ... }":
prefix: "scup"
body: "shouldComponentUpdate(nextProps, nextState) {\n\t${1}\n}"
"React: class skeleton":
prefix: "rcc"
body: "import React from \'react\';\n\nclass $1 extends React.Component {\n\trender() {\n\t\treturn (\n\t\t\t$2\n\t\t);\n\t}\n}\n\nexport default ${1};"
"React: stateless component":
prefix: "rcs"
body: "import React from \'react\';\n\nconst $1 = (${2:props}) => {\n\treturn (\n\t\t$3\n\t);\n}\n\nexport default ${1};\n"
"React: local stateless component":
prefix: "rcsl"
body: "const $1 = (${2:props}) => {\n\treturn (\n\t\t$3\n\t);\n}\n"
"React: local component function":
prefix: "rcf"
body: "${1:_methodName} ($2) {\n\t$3\n}"
"React: local component binded function":
prefix: "rcbf"
body: "${1:_methodName} = ($2) => {\n\t$3\n}"
"React: this.props.":
prefix: "props"
body: "this.props.${1}"
"React: this.state.":
prefix: "state"
body: "this.state.${1}"
"React: this.state = { ... }":
prefix: "is"
body: "this.state = {\n\t${1}: ${2}\n}"
"React: setState({ ... })":
prefix: "sst"
body: "this.setState({\n\t${1}: ${2}\n});"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment