Skip to content

Instantly share code, notes, and snippets.

@gerwld
Last active October 7, 2024 16:17
Show Gist options
  • Save gerwld/fed4bfc78fe8bd836fa469e7c5b3b77d to your computer and use it in GitHub Desktop.
Save gerwld/fed4bfc78fe8bd836fa469e7c5b3b77d to your computer and use it in GitHub Desktop.
React snippets for VSCode
// To open and edit javascriptreact.json in VS Code:
// Press Ctrl+Shift+P (or Cmd+Shift+P on Mac) to open the Command Palette.
// Type Preferences: Configure User Snippets and select it.
// Choose javascriptreact.json from the list.
{
/*
// Place your snippets for JavaScript here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');",
"$2"
],
"description": "Log output to console"
}
*/
"Add Styles Import": {
"prefix": "ims",
"body": ["import {* as s} from './index.module.css';"],
"description": "Styles Import"
},
"Add Usual Styles Import": {
"prefix": "imss",
"body": ["import s from './index.css';"],
"description": "Usual Styles Import"
},
"Add react-icons import": {
"prefix": "imi",
"body": ["import {} from 'react-icons/';"],
"description": "Import react-icons"
},
"Create Stylesheet.create base": {
"prefix": "stc",
"body": [
"",
"const styles = StyleSheet.create({\nblock: {\n$0\n},\nchild: {\n\n},\nt: {\n\n},\n});",
"",
],
"description": "Adds Stylesheet.create base"
},
"add styles fast": {
"prefix": "st",
"body": [
"style={styles.$0}",
],
"description": "Adds Stylesheet.create base"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment