Skip to content

Commit e2c80dc

Browse files
committed
Add new snippet for reducers, bump version
1 parent dd41967 commit e2c80dc

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "uruit-react-snippets",
33
"displayName": "UruIT React Snippets",
44
"description": "React Snippets with ECMAScript 6",
5-
"version": "1.1.1",
5+
"version": "1.1.2",
66
"publisher": "UruIT",
77
"icon": "images/uruit-logo.png",
88
"engines": {

snippets/snippets.json

+20
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,26 @@
288288
],
289289
"description": "Redux action"
290290
},
291+
"Redux reducer": {
292+
"prefix": "u-reducer",
293+
"body":[
294+
"import { $1 } from './$2.action';",
295+
"",
296+
"const DEFAULT_STATE = { $3 };",
297+
"",
298+
"export function homeReducer(state = DEFAULT_STATE, action) {",
299+
"\tswitch (action.type) {",
300+
"\t\tcase $1:",
301+
"\t\t\treturn {",
302+
"\t\t\t\t$0",
303+
"\t\t\t};",
304+
"\t\tdefault:",
305+
"\t\t\treturn state;",
306+
"\t}",
307+
"}"
308+
],
309+
"description": "Redux reducer"
310+
},
291311
"JSX Element className": {
292312
"prefix": "u-cn",
293313
"body": [

0 commit comments

Comments
 (0)