Created
November 25, 2019 17:50
-
-
Save gminova/c0b32f7fe9982437d4e3aea495a43709 to your computer and use it in GitHub Desktop.
Revisions
-
gminova created this gist
Nov 25, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ const ADD_TO_DO = 'ADD_TO_DO'; // A list of strings representing tasks to do: const todos = [ 'Go to the store', 'Clean the house', 'Cook dinner', 'Learn to code', ]; const immutableReducer = (state = todos, action) => { switch(action.type) { case ADD_TO_DO: return [...todos, action.todo] default: return state; } }; const addToDo = (todo) => { return { type: ADD_TO_DO, todo } } const store = Redux.createStore(immutableReducer);