Last active
February 24, 2021 12:07
-
-
Save Dchole/6244dca5fd3e4e1e2d3da5619c16d563 to your computer and use it in GitHub Desktop.
VSCode snippets for TypeScript React & JavaScript React
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
{ | |
"Basic useEffect hook": { | |
"prefix": "ueh", | |
"body": ["useEffect(() => {$2}, [$1])"], | |
"description": "Basic useEffect hook without return function" | |
}, | |
"Custom Hook": { | |
"prefix": "ch", | |
"body": [ | |
"const use${1:$TM_FILENAME_BASE} = () => {", | |
"\t$0", | |
"return true", | |
"}", | |
"\nexport default use${1:$TM_FILENAME_BASE}" | |
], | |
"description": "Basic custom hook" | |
} | |
} |
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
{ | |
"Base Component Template": { | |
"prefix": "rtc", | |
"body": [ | |
"const ${1:$TM_FILENAME_BASE} = () => {", | |
"return <>", | |
"\t$0", | |
"</>", | |
"}", | |
"\nexport default ${1:$TM_FILENAME_BASE}" | |
], | |
"description": "Base React component with no props, imports or types" | |
}, | |
"Component Wrapper": { | |
"prefix": "rttc", | |
"body": [ | |
"const ${1:$TM_FILENAME_BASE} = ({children}) => {", | |
"return <>", | |
"\t$0", | |
"</>", | |
"}", | |
"\nexport default ${1:$TM_FILENAME_BASE}" | |
], | |
"description": "Base React component with no props, but with children components" | |
}, | |
"Component With Props": { | |
"prefix": "rtcp", | |
"body": [ | |
"\nconst ${1:$TM_FILENAME_BASE} = ({$3}) => {", | |
"return <>", | |
"\t$0", | |
"</>", | |
"}", | |
"\nexport default ${1:$TM_FILENAME_BASE}" | |
], | |
"description": "React component with props and interface definition templates" | |
}, | |
"Basic useEffect hook": { | |
"prefix": "ueh", | |
"body": ["useEffect(() => {$2}, [$1])"], | |
"description": "Basic useEffect hook without return function" | |
} | |
} |
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
{ | |
"Custom Hook": { | |
"prefix": "ch", | |
"body": [ | |
"const ${1:$TM_FILENAME_BASE} = () => {", | |
"\t$0", | |
"return true", | |
"}", | |
"\nexport default ${1:$TM_FILENAME_BASE}" | |
], | |
"description": "Basic custom hook" | |
}, | |
"Component Interface": { | |
"prefix": "ri", | |
"body": ["interface I${1:$TM_FILENAME_BASE}Props {", "\t$2", "}"], | |
"description": "Interface definition for react component" | |
}, | |
"Basic useEffect hook": { | |
"prefix": "ueh", | |
"body": ["useEffect(() => {$2}, [$1])"], | |
"description": "Basic useEffect hook without return function" | |
} | |
} |
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
{ | |
"Base Component Template": { | |
"prefix": "rtc", | |
"body": [ | |
"const ${1:$TM_FILENAME_BASE} = () => {", | |
"return <>", | |
"\t$0", | |
"</>", | |
"}", | |
"\nexport default ${1:$TM_FILENAME_BASE}" | |
], | |
"description": "Base React component with no props, imports or types" | |
}, | |
"Typed Component": { | |
"prefix": "rttc", | |
"body": [ | |
"const ${1:$TM_FILENAME_BASE}:React.FC = ({children}) => {", | |
"return <>", | |
"\t$0", | |
"</>", | |
"}", | |
"\nexport default ${1:$TM_FILENAME_BASE}" | |
], | |
"description": "Base React component with no props, but with children components" | |
}, | |
"Component With Props": { | |
"prefix": "rtcp", | |
"body": [ | |
"interface I${1:$TM_FILENAME_BASE}Props {", | |
"\t$2", | |
"}", | |
"\nconst ${1:$TM_FILENAME_BASE}:React.FC<I${1:$TM_FILENAME_BASE}Props> = ({$3}) => {", | |
"return <>", | |
"\t$0", | |
"</>", | |
"}", | |
"\nexport default ${1:$TM_FILENAME_BASE}" | |
], | |
"description": "React component with props and interface definition templates" | |
}, | |
"Component Interface": { | |
"prefix": "ri", | |
"body": ["interface I${1:$TM_FILENAME_BASE}Props {", "\t$2", "}"], | |
"description": "Interface definition for react component" | |
}, | |
"Basic useEffect hook": { | |
"prefix": "ueh", | |
"body": ["useEffect(() => {$2}, [$1])"], | |
"description": "Basic useEffect hook without return function" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment