Created
June 10, 2020 07:53
-
-
Save sreetamdas/5cafa22f6b53977feef642c34533796e to your computer and use it in GitHub Desktop.
Snippets for React Hooks
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
{ | |
"React Functional Component": { | |
"prefix": "rfc", | |
"body": [ | |
"import React from \"react\";", | |
"", | |
"const $TM_FILENAME_BASE = () => {", | |
"", | |
"\treturn (", | |
"\t\t${2:}", | |
"\t)", | |
"}", | |
"", | |
"export { $TM_FILENAME_BASE }" | |
], | |
"description": "React Functional Component" | |
}, | |
"useState Hook": { | |
"prefix": "ush", | |
"body": [ | |
"const [${1}, set${1/(.*)/${1:/capitalize}/}] = useState($2);$0" | |
], | |
"description": "useState Hook" | |
}, | |
"useEffect Hook": { | |
"prefix": "ueh", | |
"body": [ | |
"useEffect(() => {", | |
"\t$1", | |
// "\n\treturn cleanUp = () => {", | |
// "\t\t$2", | |
// "\t}", | |
"}, [${3}]);$0" | |
], | |
"description": "useEffect Hook" | |
}, | |
"useLayoutEffect Hook": { | |
"prefix": "uleh", | |
"body": [ | |
"useLayoutEffect(() => {", | |
"\t$1", | |
// "\n\treturn cleanUp = () => {", | |
// "\t\t$2", | |
// "\t}", | |
"}, [${3}]);$0" | |
], | |
"description": "useLayoutEffect Hook" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment