Skip to content

Instantly share code, notes, and snippets.

@mttchpmn
Last active June 5, 2018 11:22
Show Gist options
  • Save mttchpmn/bfcb31c2f351a1401fd89f5fe60f289d to your computer and use it in GitHub Desktop.
Save mttchpmn/bfcb31c2f351a1401fd89f5fe60f289d to your computer and use it in GitHub Desktop.
React Snippets for VS Code
{
"React Class Component": {
"prefix": "rcc",
"description": "Boilerplate for React Class-based component",
"body": [
"import React, { Component} from 'react';",
"",
"class ${1:ClassName} extends Component {",
"\tconstructor(props) {",
"\t\tsuper(props);",
"\t}",
"",
"\trender() {",
"\t\treturn(",
"\t\t\t<div className=\"${1:ClassName}\">",
"\t\t\t\t$2",
"\t\t\t</div>",
"\t\t);",
"\t}",
"}",
"",
"export default ${1:ClassName};",
]
},
"React Functional Component": {
"prefix": "rfc",
"description": "Boilerplate for React Class-based component",
"body": [
"import React from 'react';",
"",
"const ${1:FuncName} = props => {",
"\treturn(",
"\t\t<div className=\"${1:FuncName}\">",
"\t\t\t$2",
"\t\t</div>",
"\t);",
"}",
"",
"export default ${1:FuncName};",
]
},
"React Div": {
"prefix": "rdiv",
"description": "React <div>",
"body": [
"<div className=\"${1:className}\">",
"\t$2",
"</div>"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment