Created
December 8, 2016 20:43
-
-
Save bessey/e58192838dd4fd57370ded8f8d39af8e to your computer and use it in GitHub Desktop.
my "JavaScript React" snippets for VS Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
/* | |
// 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