Last active
March 9, 2018 20:19
-
-
Save johanleroch/8360f1618a8f918dd0cade3a0c541bc4 to your computer and use it in GitHub Desktop.
Visual studio code 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
| { | |
| "ES6 Import": { | |
| "prefix": "xim", | |
| "body": [ | |
| "import { $0 } from '${1}';" | |
| ], | |
| "description": "ES6 Import" | |
| }, | |
| "Initial State Reducer": { | |
| "prefix": "xin", | |
| "body": [ | |
| "const INITIAL_STATE = {", | |
| "\t$0", | |
| "};" | |
| ], | |
| "description": "Initial State Reducer" | |
| }, | |
| "Reducer function": { | |
| "prefix": "xre", | |
| "body": [ | |
| "export default (state = ${1:INITIAL_STATE}, action) => {", | |
| "\tswitch (action.${2:type}) {", | |
| "\t\tcase ${3:FIRST_CASE}:", | |
| "\t\t\treturn { ...state, ${4:prop1}: action.${5:payload} };", | |
| "\t\tdefault:", | |
| "\t\t\treturn state;", | |
| "\t}", | |
| "};" | |
| ], | |
| "description": "Reducer function" | |
| }, | |
| "Case": { | |
| "prefix": "xca", | |
| "body": [ | |
| "case ${1:FIRST}:", | |
| "\treturn $0;" | |
| ], | |
| "description": "Case snippet" | |
| }, | |
| "Console log": { | |
| "prefix": "xcon", | |
| "body": [ | |
| "console.log(${1:param});$0" | |
| ], | |
| "description": "Console log snippet" | |
| }, | |
| "Redux dispatch": { | |
| "prefix": "xdis", | |
| "body": [ | |
| "dispatch({", | |
| "\ttype: ${1:TYPE},", | |
| "\tpayload: ${2:DATA}", | |
| "});" | |
| ], | |
| "description": "Redux dispatch" | |
| }, | |
| "Const Destructuring": { | |
| "prefix": "xconst", | |
| "body": [ | |
| "const { $0 } = ${1};" | |
| ], | |
| "description": "const destructuring" | |
| }, | |
| "Let Destructuring": { | |
| "prefix": "xlet", | |
| "body": [ | |
| "let { $0 } = ${1};" | |
| ], | |
| "description": "let destructuring" | |
| }, | |
| "React native class": { | |
| "prefix": "xrnc", | |
| "body": [ | |
| "import React, { Component } from 'react';", | |
| "import { View, Text, StyleSheet } from 'react-native';", | |
| "", | |
| "import { styles as s } from 'react-native-style-tachyons';", | |
| "", | |
| "class ${0:ZiiinDefaultScreen} extends Component {", | |
| "\trender() {", | |
| "\t\treturn (", | |
| "\t\t\t<View style={[styles.container]}>", | |
| "\t\t\t\t<Text style={[styles.text]}>${0:ZiiinDefaultScreen}</Text>", | |
| "\t\t\t</View>", | |
| "\t\t);", | |
| "\t}", | |
| "}", | |
| "", | |
| "const styles = StyleSheet.create({", | |
| "\tcontainer: {},", | |
| "\ttext: {},", | |
| "});", | |
| "", | |
| "export { ${0:ZiiinDefaultScreen} };", | |
| "" | |
| ], | |
| "description": "Reducer function" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment