Skip to content

Instantly share code, notes, and snippets.

@martinratinaud
Last active May 11, 2021 06:39
Show Gist options
  • Save martinratinaud/a47c7ca632388fd34e1aedd6f5ed9fff to your computer and use it in GitHub Desktop.
Save martinratinaud/a47c7ca632388fd34e1aedd6f5ed9fff to your computer and use it in GitHub Desktop.
VSCode Snippet to Create a typescript react functional component
{
"snippet-rf": {
"prefix": "rf",
"body": [
"import React from 'react';",
"import s from './${TM_FILENAME_BASE}.module.css'",
"",
"",
"interface ${TM_FILENAME_BASE}Props {",
" // TODO",
"}",
"",
"",
"const ${TM_FILENAME_BASE}: React.FC<${TM_FILENAME_BASE}Props & React.HTMLAttributes<HTMLDivElement>> = ({ children, ...props }: ${TM_FILENAME_BASE}Props & React.HTMLAttributes<HTMLDivElement>) => {",
" return (",
" <div {...props}>",
" ${TM_FILENAME_BASE}",
" $1",
" {children}",
" </div>",
" );",
"};",
"",
"export default ${TM_FILENAME_BASE};"
],
"description": "Create React functional component"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment