Created
March 29, 2020 04:38
-
-
Save raulcodes/7c55a8e28d437a5a5ee9d3695f386c80 to your computer and use it in GitHub Desktop.
Typescript/React VS Code Snippets
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
Show hidden characters
{ | |
"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