Skip to content

Instantly share code, notes, and snippets.

@ManfredHu
Last active November 16, 2022 02:41
Show Gist options
  • Save ManfredHu/0673db54d09134da1041e781444c4725 to your computer and use it in GitHub Desktop.
Save ManfredHu/0673db54d09134da1041e781444c4725 to your computer and use it in GitHub Desktop.
rfc rfcd Auto to Create React Function Components
{
"Typescript default React component": {
"prefix": "rfcd",
"body": [
"import React, { FC } from 'react'",
"",
"interface ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}Props {",
" $1",
"}",
"",
"const ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}: FC<${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}Props> = ({ $2 }) => {",
" return (",
" <div>",
" ${3:$TM_FILENAME_BASE}",
" </div>",
" )",
"}",
"",
"export default ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g};"
]
},
"Typescript React component": {
"prefix": "rfc",
"body": [
"import React, { FC } from 'react'",
"",
"interface ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}Props {",
" $1",
"}",
"",
"export const ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}: FC<${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/g}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