Skip to content

Instantly share code, notes, and snippets.

@intelliapps-io
Created June 27, 2019 01:05
Show Gist options
  • Save intelliapps-io/f4ab67068ad760a553cf1609eb087329 to your computer and use it in GitHub Desktop.
Save intelliapps-io/f4ab67068ad760a553cf1609eb087329 to your computer and use it in GitHub Desktop.
Useflit Snupp
{
// Place your snippets for typescriptreact 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');",
// "$2"
// ],
// "description": "Log output to console"
// }
"TypeScript React Function Complete": {
"prefix": "tsrfc",
"body": [
"import React from \"react\";",
"",
"interface IProps {",
"",
"}",
"",
"export const ${TM_FILENAME_BASE}: React.FC<IProps> = props => {",
"\treturn(",
"\t\t<div>",
"\t\t\t<h2>${TM_FILENAME_BASE}</h2>$0",
"\t\t</div>",
"\t);",
"}",
]
},
"TypeScript React Function": {
"prefix": "tsrf",
"body": [
"interface ${Component}Props {",
"",
"}",
"",
"export const $Component: React.FC<${Component}Props> = props => {",
"\treturn(",
"\t\t<div>",
"\t\t\t<h2>$Component</h2>$0",
"\t\t</div>",
"\t);",
"}",
]
},
"TypeScript React Class Component Full": {
"prefix": "tsrccf",
"body": [
"import * as React from \"react\";",
"",
"interface IProps {",
"",
"}",
"",
"interface IState {",
"",
"}",
"",
"class ${TM_FILENAME_BASE} extends React.Component<IProps, IState> {",
"\tconstructor(props: IProps) {",
"\t\tsuper(props);",
"\t};",
"",
"\trender() {",
"\t\treturn(",
"\t\t\t<div>",
"\t\t\t\t<h2>${TM_FILENAME_BASE}</h2>",
"\t\t\t</div>",
"\t\t);",
"\t};",
"}",
"",
"export default ${TM_FILENAME_BASE};"
]
},
"TypeScript React Class Component Simple": {
"prefix": "tsrccs",
"body": [
"import * as React from \"react\";",
"",
"interface IProps {",
"",
"}",
"",
"class ${TM_FILENAME_BASE} extends React.Component<IProps> {",
"\trender() {",
"\t\treturn(",
"\t\t\t<div>",
"\t\t\t\t<h2>${TM_FILENAME_BASE}</h2>",
"\t\t\t</div>",
"\t\t);",
"\t};",
"}",
"",
"export default ${TM_FILENAME_BASE};"
]
},
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment