Skip to content

Instantly share code, notes, and snippets.

@anandmt
Last active October 9, 2023 09:17
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anandmt/59002649bcdf90f42fa09b0306ee80cd to your computer and use it in GitHub Desktop.
Save anandmt/59002649bcdf90f42fa09b0306ee80cd to your computer and use it in GitHub Desktop.
VSCODE_SNIPPETS
{
"Next Typescript React Functional Component": {
"prefix": "fc",
"body": [
"import { FC } from 'react';",
"",
"interface ${TM_FILENAME_BASE}Props {",
" $1",
"}",
"",
"const $TM_FILENAME_BASE:FC<${TM_FILENAME_BASE}Props> =({$2})=>{",
" return <div>$TM_FILENAME_BASE</div>",
"}",
"",
"export default $TM_FILENAME_BASE",
"$2"
],
"description": "Next Typescript React Functional Component"
},
"useEffect snippet": {
"prefix": "effect",
"body": ["useEffect(() => {", "$1", "}, [$2]);"],
"description": "React useEffect snippet for client side components"
},
"useState snippet": {
"prefix": "state",
"body": ["const [$1,set${1/(.*)/${1:/capitalize}/}] = useState<$2>($3)"],
"description": "React useState snippet for client side components"
},
"useRef snippet": {
"prefix": "ref",
"body": ["const $1 = useRef<$2>($3)"],
"description": "React useRef snippet for client side components"
},
"useCallback snippet": {
"prefix": "callback",
"body": ["const $1 = useCallback(($2) => {", " $3", "}, [$4]);"],
"description": "React useCallback snippet for client side components"
}
}
@spookyuser
Copy link

I love these! Exactly what i was looking for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment