Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add named function snippets #46

Merged
merged 4 commits into from
Jun 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ Below is a list of all available snippets and the triggers of each one. The **
| `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 |
| `rsf→` | stateless named function skeleton |
| `rsfp→` | stateless named function with prop types skeleton |
| `rpt→`   | empty propTypes declaration |
| `rdp→` | empty defaultProps declaration |
| `con→` | class default constructor with props|
| `conc→` | class default constructor with props and context |
Expand Down
10 changes: 10 additions & 0 deletions snippets/snippets.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@
"body": "import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst ${1:${TM_FILENAME_BASE}} = props => {\n\treturn (\n\t\t<div>\n\t\t\t\n\t\t</div>\n\t);\n};\n\n${1:${TM_FILENAME_BASE}}.propTypes = {\n\t$0\n};\n\nexport default ${1:${TM_FILENAME_BASE}};",
"description": "Creates a stateless React component with PropTypes and ES6 module system"
},
"reactStatelessFunction": {
"prefix": "rsf",
"body": "import React from 'react';\n\nfunction ${1:${TM_FILENAME_BASE}(props) {\n\treturn (\n\t\t<div>\n\t\t\t\n\t\t</div>\n\t);\n}\n\nexport default ${1:${TM_FILENAME_BASE}};",
"description": "Creates a stateless React component as a named function without PropTypes"
},
"reactStatelessFunctionProps": {
"prefix": "rsfp",
"body": "import React from 'react';\nimport PropTypes from 'prop-types';\n\n${1:${TM_FILENAME_BASE}}.propTypes = {\n\t$0\n};\n\nfunction ${1:${TM_FILENAME_BASE}(props) {\n\treturn (\n\t\t<div>\n\t\t\t\n\t\t</div>\n\t);\n}\n\nexport default ${1:${TM_FILENAME_BASE}};",
"description": "Creates a stateless React component as a named function with PropTypes"
},

"classConstructor": {
"prefix": "con",
Expand Down