Skip to content

Instantly share code, notes, and snippets.

@kandros
Created April 6, 2022 11:14
Show Gist options
  • Save kandros/4a7fc94c4386352c39e52510576edf14 to your computer and use it in GitHub Desktop.
Save kandros/4a7fc94c4386352c39e52510576edf14 to your computer and use it in GitHub Desktop.
typescriptreact vscode snippets
{
"functional component": {
"prefix": ["func, fnc", "component", "fc", "func"],
"description": "react functional component",
"body": [
"import React from 'react'",
"type Props = {}",
"export const $TM_FILENAME_BASE: React.FC<Props> = () => {",
"\treturn (",
"\t\t<div>",
"\t\t\t$TM_FILENAME_BASE$1",
"\t\t</div>",
"\t)",
"}"
]
},
"useState": {
"prefix": "us",
"description": "React.useState",
"body": "const [$1, set${1/(.*)/${1:/capitalize}/}] = useState($2)"
},
"useEffect": {
"prefix": "ue",
"description": "React.useEffect",
"body": ["useEffect(() => {", "\t$1", "},[$2])"]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment