Skip to content

Instantly share code, notes, and snippets.

@kertnik05
Created August 2, 2022 14:19
Show Gist options
  • Select an option

  • Save kertnik05/fd3793b7a7cb2cc4eb3dbbdccb46043c to your computer and use it in GitHub Desktop.

Select an option

Save kertnik05/fd3793b7a7cb2cc4eb3dbbdccb46043c to your computer and use it in GitHub Desktop.
Visual Studio Code Snippets
{
// 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 Component": {
"prefix": "rh",
"body": [
"import { FC } from 'react'",
"",
"interface ${TM_FILENAME_BASE}Props {",
"\t$1",
"}",
"",
"const ${TM_FILENAME_BASE}: FC<${TM_FILENAME_BASE}Props> = ({$2}: ${TM_FILENAME_BASE}Props): JSX.Element => {",
"\t return (",
"\t\t<div>$3</div>",
"\t)",
"}",
"",
"export default ${TM_FILENAME_BASE}"
],
"description": "TypeScript React Function Component"
},
"console.log": {
"prefix": "cl",
"body": [
"console.log($1)"
],
"description": "console.log"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment