Created
November 29, 2016 19:52
-
-
Save hallister/6d0c2157cf726cde61f917c8a3f1dff8 to your computer and use it in GitHub Desktop.
VS Code Snippets for React/Emsi-UI
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
{ | |
"Component Will Mount": { | |
"prefix": "willmount", | |
"body": [ | |
"componentWillMount() {", | |
"\t$0", | |
"}" | |
], | |
"description": "React componentWillMount" | |
}, | |
"React componentDidMount": { | |
"prefix": "didmount", | |
"body": [ | |
"componentDidMount() {", | |
"\t$0", | |
"}" | |
], | |
"description": "React componentDidMount" | |
}, | |
"React componentWillReceiveProps": { | |
"prefix": "willreceive", | |
"body": [ | |
"componentWillReceiveProps(nextProps) {", | |
"\t$0", | |
"}" | |
], | |
"description": "React componentWillReceiveProps" | |
}, | |
"React shouldComponentUpdate": { | |
"prefix": "shouldupdate", | |
"body": [ | |
"shouldComponentUpdate(nextProps, nextState) {", | |
"\t$0", | |
"}" | |
], | |
"description": "React shouldComponentUpdate" | |
}, | |
"React CSS Module import": { | |
"prefix": "impcss", | |
"body": [ | |
"import CSSModules from 'react-css-modules';" | |
], | |
"description": "Import for react-css-modules" | |
}, | |
"React Class": { | |
"prefix": "ccomponent", | |
"body": [ | |
"import React from 'react';", | |
"", | |
"class ${id:className} extends React.Component {\n", | |
"\tstatic defaultProps = {", | |
"\t\t${props}", | |
"\t}\n", | |
"\trender() {", | |
"\t\t$2", | |
"\t}", | |
"}", | |
"", | |
"export default ${id:className};" | |
], | |
"description": "React ES6 Class Component" | |
}, | |
"React Functional Component": { | |
"prefix": "component", | |
"body": [ | |
"import React from 'react';\n", | |
"const ${id:component} = (${props}) => {", | |
"\treturn (", | |
"\t\t${content}", | |
"\t);", | |
"};\n", | |
"${id:component}.propTypes = {", | |
"\t${propTypes}", | |
"};\n", | |
"export default ${id:component};" | |
] | |
}, | |
"React String Prop": { | |
"prefix": "rpstring", | |
"body": [ | |
"${prop}: React.PropTypes.string,${1}" | |
] | |
}, | |
"React Shape Prop": { | |
"prefix": "rpshape", | |
"body": [ | |
"${prop}: React.PropTypes.shape({", | |
"\t${props}", | |
"}),${1}" | |
] | |
}, | |
"EMSI UI Import": { | |
"prefix": "emsi", | |
"body": [ | |
"import ${id:component} from 'emsi-ui/lib/${id:component}';\n" | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment