Skip to content

Instantly share code, notes, and snippets.

@victorwpbastos
Created October 9, 2019 16:02
Show Gist options
  • Save victorwpbastos/4f27c734ccddf0a96f63736a5b55a792 to your computer and use it in GitHub Desktop.
Save victorwpbastos/4f27c734ccddf0a96f63736a5b55a792 to your computer and use it in GitHub Desktop.
VS Code snippets
{
// Place your snippets for javascript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": ["console.log($1);"],
"description": "Log output to console"
},
"React Component": {
"prefix": "rc",
"body": [
"import React from 'react';",
"",
"const ${TM_DIRECTORY/^.+\\\\(.*)$/$1/}${1|Component,Page|} = () => (",
"\t<div>",
"\t\t$0<h2>Hey, I'm ${TM_DIRECTORY/^.+\\\\(.*)$/$1/}${1|Component,Page|}</h2>",
"\t</div>",
");",
"",
"export default ${TM_DIRECTORY/^.+\\\\(.*)$/$1/}${1|Component,Page|};"
],
"description": "Create a React functional component"
},
"React Native Component": {
"prefix": "rnc",
"body": [
"import React from 'react';",
"import { Text, View, StyleSheet } from 'react-native';",
"",
"const ${TM_DIRECTORY/^.+\\\\(.*)$/$1/}${1|Component,Page|} = () => {",
"\treturn (",
"\t\t<View style={styles.container}>",
"\t\t\t$0<Text>Hey, I'm ${TM_DIRECTORY/^.+\\\\(.*)$/$1/}${1|Component,Page|}!</Text>",
"\t\t</View>",
"\t);",
"};",
"",
"const styles = StyleSheet.create({",
"\tcontainer: {",
"\t\tflex: 1,",
"\t\tjustifyContent: 'center',",
"\t\talignItems: 'center'",
"\t}",
"});",
"",
"export default ${TM_DIRECTORY/^.+\\\\(.*)$/$1/}${1|Component,Page|};"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment