Skip to content

Instantly share code, notes, and snippets.

@LeoLeBras
Last active June 28, 2017 09:13
Show Gist options
  • Save LeoLeBras/046fffb2ffc79aaaaa3b4fa28555aec6 to your computer and use it in GitHub Desktop.
Save LeoLeBras/046fffb2ffc79aaaaa3b4fa28555aec6 to your computer and use it in GitHub Desktop.
VSCode Snippets
{
"Console Log": {
"prefix": "log",
"body": [
"console.log(${1})",
],
"description": "Log something in console"
},
"Create StyleSheet": {
"prefix": "ss",
"body": [
"/* @flow */",
"",
"import { StyleSheet } from 'react-native'",
"",
"const styles = StyleSheet.create({",
"\t${1}",
"})",
"",
"export default styles",
],
"description": "Create StyleSheet"
},
"Create React Stateless Component": {
"prefix": "sc",
"body": [
"/* @flow */",
"",
"import React from 'react'",
"import { ${3} } from 'react-native'",
"",
"type Props = {",
"\t${2}",
"}",
"",
"const ${1} = (props: Props) => {",
"\treturn (",
"\t\t${4}",
"\t)",
"}",
"",
"export default ${1}"
],
"description": "Create Stateless Component"
},
"Create React Class Component": {
"prefix": "cc",
"body": [
"/* @flow */",
"",
"import React from 'react'",
"import { ${4} } from 'react-native'",
"",
"type Props = {",
"\t${2}",
"}",
"",
"class ${1} extends React.Component<void, Props, void> {",
"\tprops: Props",
"\t",
"\tshouldComponentUpdate() {",
"\t\t\treturn ${3}",
"\t}",
"\t",
"\trender() {",
"\t\treturn (",
"\t\t\t${5}",
"\t\t)",
"\t}",
"}",
"",
"export default ${1}"
],
"description": "Create Stateless Component"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment