Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
xabikos committed Apr 17, 2018
2 parents 09393b9 + 21504b9 commit a164183
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ Below is a list of all available snippets and the triggers of each one. The **
| `cwup→` | `componentWillUpdate method` |
| `cdup→` | `componentDidUpdate method` |
| `cwun→` | `componentWillUnmount method` |
| `gsbu→` | `getSnapshotBeforeUpdate method` |
| `gdsfp→` | `static getDerivedStateFromProps method` |
| `cdc→` | `componentDidCatch method` |
| `ren→` | `render method` |
| `sst→` | `this.setState with object as parameter` |
| `ssf→` | `this.setState with function as parameter` |
Expand Down
19 changes: 17 additions & 2 deletions snippets/snippets.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"componentWillReceiveProps": {
"prefix": "cwr",
"body": "componentWillReceiveProps(nextProps) {\n\t$0\n}\n",
"description": "Invoked when a component is receiving new props. This method is not called for the initial render."
"description": "Invoked when a component is receiving new props. This method is not called for the initial render. [DEPRECATION NOTE]: This method is deprecated in React 16.3"
},

"shouldComponentUpdate": {
Expand All @@ -96,7 +96,7 @@
"componentWillUpdate": {
"prefix": "cwup",
"body": "componentWillUpdate(nextProps, nextState) {\n\t$0\n}\n",
"description": "Invoked immediately before rendering when new props or state are being received."
"description": "Invoked immediately before rendering when new props or state are being received. [DEPRECATION NOTE]: This method is deprecated in React 16.3"
},

"componentDidUpdate": {
Expand Down Expand Up @@ -308,5 +308,20 @@
"prefix": "ptshr",
"body": "PropTypes.shape({\n\t$0\n}).isRequired,",
"description": "An object taking on a particular shape required"
},
"getSnapshotBeforeUpdate": {
"prefix": "gsbu",
"body": "getSnapshotBeforeUpdate(prevProps, prevState) {\n\t$0\n}\n",
"description": "Invoked right before the most recently rendered output is committed to e.g. the DOM. It enables your component to capture current values"
},
"getDerivedStateFromProps": {
"prefix": "gdsfp",
"body": "static getDerivedStateFromProps(nextProps, prevState) {\n\t$0\n}\n",
"description": "Invoked after a component is instantiated as well as when it receives new props."
},
"componentDidCatch": {
"prefix": "cdc",
"body": "componentDidCatch(error, info) {\n\t$0\n}\n",
"description": "Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them."
}
}

0 comments on commit a164183

Please sign in to comment.