Skip to content

Instantly share code, notes, and snippets.

@lucianomlima
Last active April 18, 2018 03:10
Show Gist options
  • Save lucianomlima/ad1d16a92841a60c0a257047cd1b55e2 to your computer and use it in GitHub Desktop.
Save lucianomlima/ad1d16a92841a60c0a257047cd1b55e2 to your computer and use it in GitHub Desktop.
React Native Atom snippets
{
".source.js":
"React: import component":
prefix: "li"
body: "import ${1} from './${1}';"
"React: constructor":
prefix: "construct"
body: "constructor(props) {\n\tsuper(props);\n\t${1}\n}"
"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: componentDidCatch(e, i) { ... }":
prefix: "cdc"
body: "componentDidCatch(error, info) {\n\t${1}\n}"
"React: getDerivedStateFromProps(np, ps) { ... }":
prefix: "gdsfp"
body: "getDerivedStateFromProps(nextProps, prevState) {\n\t${1}\n}"
"React: getSnapshotBeforeUpdate(pp, ps) { ... }":
prefix: "gsbu"
body: "getSnapshotBeforeUpdate(prevProps, prevState) {\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\t$3\n);\n\nexport default ${1};\n"
"React: local stateless component":
prefix: "rcsl"
body: "const $1 = ${2:props} => (\n\t$3\n);\n"
"React: component method":
prefix: "rcm"
body: "${1:_methodName} ($2) {\n\t$3\n}"
"React: component binded method":
prefix: "rcbm"
body: "${1:_methodName} = ($2) => {\n\t$3\n}"
"React: this.props.":
prefix: "props"
body: "this.props.${1}"
"React: const { p } this.props":
prefix: "cprops"
body: "const { $1 } = this.props;"
"React: this.state.":
prefix: "state"
body: "this.state.${1}"
"React: const { s } this.state":
prefix: "cstate"
body: "const { $1 } = this.state;"
"React: this.state = { ... }":
prefix: "is"
body: "this.state = {\n\t${1}: ${2}\n}"
"React: setState({ ... })":
prefix: "sst"
body: "this.setState({ ${1}: ${2} });"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment