Skip to content

Commit

Permalink
Add snippet for pure component class
Browse files Browse the repository at this point in the history
  • Loading branch information
xabikos committed Nov 19, 2017
1 parent 56a45b6 commit b61b161
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Below is a list of all available snippets and the triggers of each one. The **
| `rcjc→` | class component skeleton without import and default export lines |
| `rcfc→` | class component skeleton that contains all the lifecycle methods |
| `rwwd→` | class component without import statements |
| `rpc→` | class pure component skeleton with prop types after the class |
| `rsc→` | stateless component skeleton |
| `rscp→` | stateless component with prop types skeleton |
| `rpt→` | empty propTypes declaration |
Expand Down
6 changes: 6 additions & 0 deletions snippets/snippets.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
"description": "Creates a React component class with constructor, empty state, proptypes and export in ES6 module system without imports. (Mostly used when React, Proptypes are provided by webpack provide plugin)"
},

"reactPureComponent": {
"prefix": "rpc",
"body": "import React, { PureComponent } from 'react';\nimport PropTypes from 'prop-types';\n\nclass ${1:componentName} extends PureComponent {\n\trender() {\n\t\treturn (\n\t\t\t<div>\n\t\t\t\t$0\n\t\t\t</div>\n\t\t);\n\t}\n}\n\n${1:componentName}.propTypes = {\n\n};\n\nexport default ${1:componentName};",
"description": "Creates a React pure component class with PropTypes and ES6 module system"
},

"reactStateless": {
"prefix": "rsc",
"body": "import React from 'react';\n\nconst ${1:componentName} = () => {\n\treturn (\n\t\t<div>\n\t\t\t$0\n\t\t</div>\n\t);\n};\n\nexport default ${1:componentName};",
Expand Down

0 comments on commit b61b161

Please sign in to comment.