Skip to content

feat: add shortcut to generate state variable with hooks #10

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
16 changes: 10 additions & 6 deletions snippets/snippets.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
// import
"section-1": "IMPORTS",
"ES6 React Import": {
"prefix": "imr",
"body": "import React from 'react'\n"
Expand All @@ -20,7 +20,7 @@
"prefix": "imc",
"body": "import ${1:componentName} from './components/${1:componentName}'\n"
},
// React
"section-2": "REACT",
"reactClassCompoment": {
"prefix": "rcc",
"body": "import React, { Component } from 'react'\n\nexport default class ${1:componentName} extends Component {\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",
Expand Down Expand Up @@ -321,7 +321,12 @@
"body": "PropTypes.shape({\n\t$0\n}).isRequired,",
"description": "An object taking on a particular shape required"
},
// Redux
"reactStateHook": {
"prefix": "rhk",
"body": "const [count, setCount] = React.useState(0)",
"description": "declare a new state variable using hooks"
},
"section-3": "REDUX",
"Import reselect": {
"prefix": "imcreateSelector",
"body": "import { createSelector } from 'reselect'\n",
Expand Down Expand Up @@ -380,7 +385,7 @@
],
"description": "Redux selector."
},
// react-redux
"section-4": "REACT-REDUX",
"Connect Redux": {
"prefix": "imconnect",
"body": "import { connect } from 'react-redux'\n"
Expand Down Expand Up @@ -442,7 +447,7 @@
],
"description": "Redux container"
},
// react-router
"section-5": "REACT-ROUTER",
"ES6 react-router Import": {
"prefix": "imrr",
"body": [
Expand Down Expand Up @@ -476,7 +481,6 @@
"prefix": "navlink",
"body": "<NavLink to={${1:path}}>{$anchorText}</NavLink>\n"
},
// comment block
"Comment Block": {
"prefix": "cmmb",
"body": [
Expand Down