Skip to content

Instantly share code, notes, and snippets.

@danielbellmas
Last active October 14, 2022 12:54
Show Gist options
  • Save danielbellmas/b842c5c6342425dbcd17a338cba1d4b6 to your computer and use it in GitHub Desktop.
Save danielbellmas/b842c5c6342425dbcd17a338cba1d4b6 to your computer and use it in GitHub Desktop.
Visual Studio Code Snippets for a Typescript React component
"Typescript default React component": {
"scope": "typescriptreact",
"prefix": "rfcd",
"body": [
"import React, { FC } from 'react'",
"",
"interface ${TM_FILENAME_BASE}Props {",
" $1",
"}",
"",
"const ${TM_FILENAME_BASE}: FC<${TM_FILENAME_BASE}Props> = ({ $2 }) => {",
" return (",
" <div>",
" ${3:$TM_FILENAME_BASE}",
" </div>",
" )",
"}",
"",
"export default ${TM_FILENAME_BASE};"
],
},
"Typescript React component": {
"scope": "typescriptreact",
"prefix": "rfc",
"body": [
"import React, { FC } from 'react'",
"",
"interface ${TM_FILENAME_BASE}Props {",
" $1",
"}",
"",
"export const ${TM_FILENAME_BASE}: FC<${TM_FILENAME_BASE}Props> = ({ $2 }) => {",
" return (",
" <div>",
" ${3:$TM_FILENAME_BASE}",
" </div>",
" )",
"}",
],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment