Skip to content

Instantly share code, notes, and snippets.

@velopert
Created May 19, 2018 04:55
Show Gist options
  • Save velopert/fa5140208ddc2d71932478952434ded7 to your computer and use it in GitHub Desktop.
Save velopert/fa5140208ddc2d71932478952434ded7 to your computer and use it in GitHub Desktop.
TypeScript VSCode snippet
{
"Create Stateless component": {
"prefix": "rsc",
"body": [
"import * as React from 'react';",
"",
"interface ${1:${TM_FILENAME_BASE}}Props {",
" someProps: boolean;",
"}",
"",
"const ${1:${TM_FILENAME_BASE}}: React.SFC<${1:${TM_FILENAME_BASE}}Props> = () => {",
" return <div>${1:${TM_FILENAME_BASE}}</div>;",
"};",
"",
"export default ${1:${TM_FILENAME_BASE}};",
""
],
"description": ""
},
"Create React Class Component": {
"prefix": "rcc",
"body": [
"import * as React from 'react';",
"",
"interface ${1:${TM_FILENAME_BASE}}Props {",
" someValue: boolean;",
"}",
"",
"class ${1:${TM_FILENAME_BASE}} extends React.Component {",
" public render() {",
" return (",
" <div>${1:${TM_FILENAME_BASE}}</div>",
" );",
" }",
"}",
"",
"export default ${1:${TM_FILENAME_BASE}};"
],
"description": ""
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment