-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathjsx.code-snippets
executable file
·71 lines (71 loc) · 2.21 KB
/
jsx.code-snippets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
// React (JS)
"component static prop types": {
"prefix": "propTypes",
"body": "static propTypes = {$0}",
"description": "Component Static Prop Types"
},
"component static default props": {
"prefix": "defaultProps",
"body": "static defaultProps = {$0}",
"description": "Component Static Default Props"
},
"component static get derived state from props": {
"prefix": "getDerivedStateFromProps",
"body": "static getDerivedStateFromProps(${1:nextProps}, ${2:prevState}) {$0}",
"description": "Component Static Get Derived State From Props"
},
"component set state": {
"prefix": "setState",
"body": "this.setState($1)$0"
},
"component constructor": {
"prefix": "constructor",
"body": [
"constructor(${1:props}) {",
"\tsuper(${1:props})",
"",
"\t$4",
"}"
]
},
"component will mount": {
"prefix": "componentWillMount",
"body": "componentWillMount() {$0}",
"description": "DEPRECATION WARNING [v16.3]: Use `componentDidMount` instead."
},
"component did mount": {
"prefix": "componentDidMount",
"body": "componentDidMount() {$0}"
},
"component will receive props": {
"prefix": "componentWillReceiveProps",
"body": "componentWillReceiveProps(${1:nextProps}) {$0}",
"description": "DEPRECATION WARNING [v16.3]: Use `static getDerivedStateFromProps` instead."
},
"should component update": {
"prefix": "shouldComponentUpdate",
"body": "shouldComponentUpdate(${1:nextProps}, ${2:nextState}) {$0}"
},
"component will update": {
"prefix": "componentWillUpdate",
"body": "componentWillUpdate(${1:nextProps}, ${2:nextState}) {$0}",
"description": "DEPRECATION WARNING [v16.3]: Use `componentDidUpdate` instead."
},
"component did update": {
"prefix": "componentDidUpdate",
"body": "componentDidUpdate(${1:nextProps}, ${2:state}) {$0}"
},
"component will unmount": {
"prefix": "componentWillUnmount",
"body": "componentWillUnmount() {$0}"
},
"component did catch": {
"prefix": "componentDidCatch",
"body": "componentDidCatch(${1:error}, ${2:errorInfo}) {$0}"
},
"component render": {
"prefix": "render",
"body": ["render() {", "\treturn ($0)", "}"]
}
}