Last active
May 11, 2021 06:39
-
-
Save martinratinaud/a47c7ca632388fd34e1aedd6f5ed9fff to your computer and use it in GitHub Desktop.
VSCode Snippet to Create a typescript react functional component
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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