瀏覽代碼

feat(ToDoReducer): add ToDoReducer with initial sate and TODO_TEXT_UPDATE action type

Helder 6 年之前
父節點
當前提交
f0b6603107
共有 1 個文件被更改,包括 18 次插入0 次删除
  1. 18 0
      src/app/store/reducers/toDoReducer.js

+ 18 - 0
src/app/store/reducers/toDoReducer.js

@@ -0,0 +1,18 @@
+
+
+const initialState = {
+  todoText: ''
+}
+
+export default function reducer(state=initialState, action){
+    switch (action.type){
+        case "TODO_TEXT_UPDATE":{
+            return {
+                ...state,
+                { todoText} :action.payload,
+            };
+        }
+        default:
+            return state
+    }
+}