forked from nabilashraf/mac-setup
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsnippets.code-snippets
75 lines (75 loc) · 2.82 KB
/
snippets.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
72
73
74
75
{
// React
"importReact": {
"prefix": "impr",
"body": "import React from 'react';",
"description": "Import React"
},
"importReactWithComponent": {
"prefix": "imprc",
"body": "import React, { Component } from 'react';",
"description": "Import React with Component element"
},
"importReactDOM": {
"prefix": "imprd",
"body": "import ReactDOM from 'react-dom';",
"description": "Import ReactDOM"
},
"destructState": {
"prefix": "dss",
"body": "const { $1 } = this.state;",
"description": "Destruct React class component state"
},
"destructProps": {
"prefix": "dsp",
"body": "const { $1 } = this.props;",
"description": "Destruct React class component props"
},
"reactClassComponent": {
"prefix": "rcc",
"body": "import React, { Component } from 'react';\n\nclass ${1:${TM_FILENAME_BASE}} 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\nexport default ${1:${TM_FILENAME_BASE}};",
"description": "Create React class component"
},
"reactClassComponentPropTypes": {
"prefix": "rccp",
"body": "import React, { Component } from 'react';\nimport PropTypes from 'prop-types';\n\nclass ${1:${TM_FILENAME_BASE}} 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\n${1:${TM_FILENAME_BASE}}.propTypes = {\n\n};\n\nexport default ${1:${TM_FILENAME_BASE}};",
"description": "Create React class component with PropTypes"
},
"reactStateless": {
"prefix": "rsc",
"body": "import React from 'react';\n\nconst ${1:${TM_FILENAME_BASE}} = () => {\n\treturn (\n\t\t<div>\n\t\t\t$0\n\t\t</div>\n\t);\n};\n\nexport default ${1:${TM_FILENAME_BASE}};",
"description": "Create React stateless component"
},
"reactStatelessProps": {
"prefix": "rscp",
"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": "Create React stateless component with PropTypes"
},
// CommonJS
"require": {
"prefix": "req",
"body": "require('$2');",
"description": "Require module"
},
"requireConstant": {
"prefix": "reqc",
"body": "const $1 = require('$2');",
"description": "Require module and assign it to constant"
},
// Other
"consoleLog": {
"prefix": "con",
"body": "console.log($1);",
"description": "Output a message to console"
},
"import": {
"prefix": "imp",
"body": "import $2 from '$1';",
"description": "Import entire module"
},
"importDestructing": {
"prefix": "impd",
"body": "import { $2 } from '$1';",
"description": "Import element from module"
},
}