Skip to content

Commit

Permalink
added uec react snippet
Browse files Browse the repository at this point in the history
  • Loading branch information
capaj committed May 24, 2020
1 parent 089c2be commit 2f7b93e
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 44 deletions.
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": false,
"arrowParens": "always",
"singleQuote": true,
"trailingComma": "none"
}
86 changes: 43 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -999,49 +999,49 @@ If you're not writing react, including them should not really bother you because
These were originally taken from https://github.com/TimonVS/vscode-react-standard because the maintainer wasn't able to publish a new version for months even when there was a considerable flaw in the released version.
Below is a list of all available snippets and the triggers of each one.

| Trigger | Content |
| ------- | ---------------------------------------------------------------- |
| `j` | jsx element |
| `dp` | destructuring of props |
| `ds` | destructuring of props |
| `jc` | jsx self-closed element |
| `jm` | `jsx elements map` |
| `jmr` | `jsx elements map with return` |
| `rcc` | class component skeleton |
| `rccp` | class component skeleton with prop types after the class |
| `rcjc` | class component skeleton without import and default export lines |
| `rcfc` | class component skeleton that contains all the lifecycle methods |
| `rfc` | stateless component skeleton |
| `rfcp` | stateless component with prop types skeleton |
| `rpt` | empty propTypes declaration |
| `con` | class default constructor with props |
| `conc` | class default constructor with props and context |
| `est` | empty state object |
| `cwm` | `componentWillMount method` |
| `cdm` | `componentDidMount method` |
| `cwr` | `componentWillReceiveProps method` |
| `cgd` | `componentGetDerivedStateFromProps method` |
| `scu` | `shouldComponentUpdate method` |
| `cwup` | `componentWillUpdate method` |
| `cdup` | `componentDidUpdate method` |
| `cwun` | `componentWillUnmount method` |
| `ren` | `render method` |
| `sst` | `this.setState with object as parameter` |
| `ssf` | `this.setState with function as parameter` |
| `tp` | `this.props` |
| `ts` | `this.state` |
| `us` | `useState` |
| `ue` | `useEffect` |
| `ur` | `useRef` |
| `uc` | `useContext` |
| `ume` | `useMemo` |
| ------- | ---------------------------------------------------------------- |
| `uq` | `useQuery` to be used with graphql-codegen |
| `uqc` | `useQuery` that loads up data for current component, to be used with graphql-codegen |
| `um` | `useMutation` to be used with graphql-codegen |
| `uqg` | `useQuery with raw gql` |
| `umg` | `useMutation with raw gql` |

| Trigger | Content |
| ------- | ------------------------------------------------------------------------------------ |
| `j` | jsx element |
| `dp` | destructuring of props |
| `ds` | destructuring of props |
| `jc` | jsx self-closed element |
| `jm` | `jsx elements map` |
| `jmr` | `jsx elements map with return` |
| `rcc` | class component skeleton |
| `rccp` | class component skeleton with prop types after the class |
| `rcjc` | class component skeleton without import and default export lines |
| `rcfc` | class component skeleton that contains all the lifecycle methods |
| `rfc` | stateless component skeleton |
| `rfcp` | stateless component with prop types skeleton |
| `rpt` | empty propTypes declaration |
| `con` | class default constructor with props |
| `conc` | class default constructor with props and context |
| `est` | empty state object |
| `cwm` | `componentWillMount method` |
| `cdm` | `componentDidMount method` |
| `cwr` | `componentWillReceiveProps method` |
| `cgd` | `componentGetDerivedStateFromProps method` |
| `scu` | `shouldComponentUpdate method` |
| `cwup` | `componentWillUpdate method` |
| `cdup` | `componentDidUpdate method` |
| `cwun` | `componentWillUnmount method` |
| `ren` | `render method` |
| `sst` | `this.setState with object as parameter` |
| `ssf` | `this.setState with function as parameter` |
| `tp` | `this.props` |
| `ts` | `this.state` |
| `us` | `useState` |
| `ue` | `useEffect` |
| `uec` | `useEffect` with a cleanup function |
| `ur` | `useRef` |
| `uc` | `useContext` |
| `ume` | `useMemo` |
| ------- | ---------------------------------------------------------------- |
| `uq` | `useQuery` to be used with graphql-codegen |
| `uqc` | `useQuery` that loads up data for current component, to be used with graphql-codegen |
| `um` | `useMutation` to be used with graphql-codegen |
| `uqg` | `useQuery with raw gql` |
| `umg` | `useMutation with raw gql` |

There are also snippets to be triggered with a text selection(trigger via insert snippet command):

Expand Down
7 changes: 6 additions & 1 deletion snippets/react-ts.json
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@
},
"useEffect": {
"prefix": "ue",
"body": ["useEffect(() => {", "\t$1", "}, [${3:dependencies}])$0"],
"description": "React useEffect() hook"
},
"useEffect with cleanup": {
"prefix": "uec",
"body": [
"useEffect(() => {",
"\t$1",
Expand All @@ -293,7 +298,7 @@
"\t}",
"}, [${3:dependencies}])$0"
],
"description": "React useEffect() hook"
"description": "React useEffect() hook with a cleanup function"
},
"useContext": {
"prefix": "uc",
Expand Down

0 comments on commit 2f7b93e

Please sign in to comment.