Created
July 20, 2021 18:25
-
-
Save stdavis/f4fbb8883121573330bbeaad4c7c115f to your computer and use it in GitHub Desktop.
react snippets
This file contains hidden or 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 - didn't work in javascriptreact.json | |
"react component": { | |
"prefix": "comp", | |
"body": [ | |
"const ${1:ComponentName} = () => {", | |
" return (", | |
" <div>$0</div>", | |
" );", | |
"};", | |
"", | |
"export default ${1:ComponentName};" | |
], | |
"description": "create new react functional component" | |
}, | |
"useEffect": { | |
"prefix": "ue", | |
"body": ["React.useEffect(() => {", " $0", "}, [${1:deps}]);"] | |
}, | |
"useRef": { | |
"prefix": "ur", | |
"body": ["const $1 = React.useRef(${2:null});"] | |
}, | |
"useState": { | |
"prefix": "us", | |
"body": ["const [$1, $2] = React.useState($3);"] | |
}, | |
"useContext": { | |
"prefix": "uc", | |
"body": ["const {$2} = React.useContext($1);"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment