Skip to content

Instantly share code, notes, and snippets.

@bessey
Created December 8, 2016 20:43
Show Gist options
  • Save bessey/e58192838dd4fd57370ded8f8d39af8e to your computer and use it in GitHub Desktop.
Save bessey/e58192838dd4fd57370ded8f8d39af8e to your computer and use it in GitHub Desktop.
my "JavaScript React" snippets for VS Code
{
/*
// Place your snippets for JavaScript React 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, ${id} and ${id:label} and ${1:label} for variables. Variables with the same id are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
*/
"New Component": {
"prefix": "component",
"body": [
"import React, { Component, PropTypes } from \"react\"",
"",
"export default class ${ComponentName} extends Component {",
" static propTypes = {",
" }",
"",
" render() {",
" return (",
" <div></div>",
" )",
" }",
"}"
],
"description": "Fresh ES6 React component boilerplate"
},
"New Pure Component": {
"prefix": "pure component",
"body": [
"import React, { PropTypes } from 'react';",
"",
"export default function ${ComponentName}(props) {",
" return (",
" <div>",
" </div>",
" )",
"}",
"",
"${ComponentName}.propTypes = {",
"}"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment