Skip to content

Instantly share code, notes, and snippets.

@srph
Created April 9, 2024 07:26
Show Gist options
  • Save srph/c3fa180d691ff5285e45b85405a6b0b4 to your computer and use it in GitHub Desktop.
Save srph/c3fa180d691ff5285e45b85405a6b0b4 to your computer and use it in GitHub Desktop.
React Component Snippet for VS Code (based on filename, with prop types)
{
"React Component": {
"prefix": "0rc",
"body": [
"import React from 'react';",
"",
"interface ${TM_FILENAME_BASE}Props {",
" name: string;",
"}",
"",
"const ${TM_FILENAME_BASE} = (props: ${TM_FILENAME_BASE}Props) => {",
" return (",
" <div>",
" <h1>Hello, {props.name}</h1>",
" </div>",
" );",
"};",
"",
"export { ${TM_FILENAME_BASE} };"
],
"description": "Create a new React component"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment