Skip to content

Instantly share code, notes, and snippets.

@raulcodes
Created March 29, 2020 04:38
Show Gist options
  • Save raulcodes/7c55a8e28d437a5a5ee9d3695f386c80 to your computer and use it in GitHub Desktop.
Save raulcodes/7c55a8e28d437a5a5ee9d3695f386c80 to your computer and use it in GitHub Desktop.
Typescript/React VS Code Snippets
{
"Typescript Functional Component": {
"prefix": "tsxComponent",
"body": [
"import * as React from 'react';",
"",
"interface ${1:Component}Props {",
"}",
"",
"const ${1:Component} = ({}: ${1:Component}Props): React.ReactElement => {",
"\treturn ();",
"};",
"",
"export default ${1:Component};"
]
},
"Typescript interface": {
"prefix": "tsInt",
"body": [
"interface ${1:Name} {",
"}"
]
},
"React useState Hook": {
"prefix": "stateHook",
"body": "const [${1:sVar}, set${1:sVar}] = React.useState(${2:initial});"
},
"React useEffect Hook": {
"prefix": "effectHook",
"body": [
"React.useEffect(() => {",
"\t${1:body}",
"}, [${dependencyList}]);"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment