-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjavascript.json
More file actions
67 lines (66 loc) · 1.7 KB
/
javascript.json
File metadata and controls
67 lines (66 loc) · 1.7 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
{
// Place your snippets for javascript 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');",
// "$2"
// ],
// "description": "Log output to console"
"Combine Reducers": {
"prefix": "rdxcr",
"body": [
"import {combineReducers} from 'redux';",
"import ${2}Reducer from '$3';",
"",
"export default combineReducers({",
" $1: ${2}Reducer",
"});",
],
"description": "it combines reducers i bet you totally couldn't guess that"
},
"Action Creator": {
"prefix": "rdxac",
"body": [
"import {dispatch} from '../store';",
"",
"const ${2:ACTION_TYPE} = '$2';",
"function $1(actionData) {",
" return {",
" type: ${2},",
" payload: actionData",
" }",
"}",
"export const bound$3 = (payload) => dispatch($1(payload))"
]
},
"Create Store": {
"prefix": "rdxcs",
"body": [
"import { createStore } from 'redux'",
"import $1 from '../reducers'",
"export default createStore($1)"
]
},
"Create Reducer": {
"prefix": "rdxr",
"body": [
"let defaultState = {$1}",
"export default function (state = defaultState, action) {",
" switch (action.type) {",
" case '$2':",
" return {",
" ...state,",
" $3",
" }",
" default:",
" return state;",
" }",
"};"
]
}
}