Last active
August 31, 2018 17:33
-
-
Save iAmShakil/9eff0b758a60b32cebef2898d962058c to your computer and use it in GitHub Desktop.
Revisions
-
iAmShakil revised this gist
Aug 31, 2018 . 1 changed file with 0 additions and 5 deletions.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 @@ -16,20 +16,15 @@ function createStore(reducer){ function getState(){ return state } function dispatch(){ } function subscribe(){ // invoking this returned function will remove the subscriber function return function(){ } } return { getState: getState, dispatch: dispatch, -
iAmShakil created this gist
Aug 31, 2018 .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,38 @@ const reducer = ( state = 0, action ) => { switch(action.type){ case "INCREMENT": return state + 1 case "DECREMENT": return state - 1 default: return state } } function createStore(reducer){ // declaring the variable that holds state of the store var state function getState(){ return state } function dispatch(){ } function subscribe(){ // invoking this returned function will remove the subscriber function return function(){ } } return { getState: getState, dispatch: dispatch, subscribe: subscribe, } }