-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypescriptreact.json
More file actions
111 lines (111 loc) · 3.13 KB
/
Copy pathtypescriptreact.json
File metadata and controls
111 lines (111 loc) · 3.13 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{
// Place your snippets for TypeScript React here. Each snippet is defined under a snippet name and has a prefix, body and
// description. The prefix is what is used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders. Placeholders with the
// same ids are connected.
// Example:
"Print to console": {
"prefix": "log",
"body": [
"console.log('$1');"
],
"description": "Log output to console"
},
"Import from module": {
"prefix": "imp",
"body": [
"import { $0 } from '${1:module}';"
],
"description": "Import from module"
},
"Class name": {
"prefix": "cn",
"body": [
"className={b('$0')()}"
],
"description": "React Class name"
},
"React connected container": {
"prefix": "rcc",
"body": [
"import * as React from 'react';",
"import * as block from 'bem-cn';",
"import { bind } from 'decko';",
"import { connect } from 'react-redux';",
"import { bindActionCreators, Dispatch } from 'redux';",
"",
"import { IAppReduxState } from 'shared/types/app';",
"import { ITranslateProps, i18nConnect } from 'services/i18n';",
"",
"import { IReduxState } from '../../../namespace';",
"import * as actions from './../../../redux/actions';",
"import * as selectors from './../../../redux/selectors';",
"import './${1:$TM_FILENAME_BASE}.styl';",
"",
"interface IOwnProps {",
"\t",
"}",
"",
"interface IStateProps {",
"\t",
"}",
"",
"interface IActionProps {",
"\t",
"}",
"",
"type IProps = IStateProps & IActionProps & IOwnProps;",
"",
"function mapState(state: IAppReduxState): IStateProps {",
"\treturn {};",
"}",
"",
"function mapDispatch(dispatch: Dispatch<IAppReduxState>): IActionProps {",
"\treturn bindActionCreators({}, dispatch);",
"}",
"",
"const b = block('${2:block-name}');",
"",
"class $1 extends React.PureComponent<IProps & ITranslateProps, {}> {",
"\tpublic render() {",
"\t\treturn (",
"\t\t\t<div></div>",
"\t\t);",
"\t}",
"}",
"",
"export { $1 };",
"export default connect<IStateProps, IActionProps, IOwnProps>(mapState, mapDispatch)(i18nConnect<IProps>($1));",
""
],
"description": "React connected container"
},
"React component": {
"prefix": "rc",
"body": [
"import * as React from 'react';",
"import * as block from 'bem-cn';",
"import { bind } from 'decko';",
"",
"import './${1:$TM_FILENAME_BASE}.styl';",
"",
"interface IProps {",
"\t",
"}",
"",
"const b = block('${2:block-name}');",
"",
"class $1 extends React.PureComponent<IProps, {}> {",
"\tpublic render() {",
"\t\treturn (",
"\t\t\t<div></div>",
"\t\t);",
"\t}",
"}",
"",
"export default $1;",
""
],
"description": "React component"
}
}