Created
June 10, 2018 10:49
-
-
Save kiok46/923f1a5604319e232d320c3fe84049bb to your computer and use it in GitHub Desktop.
Redux, Store, Actions, Reducers and logger: Get Started and a little further (1)
This file contains 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 characters
const INITIAL_STATE = { | |
text: '' | |
}; | |
export default ( state=INITIAL_STATE , action ) => { | |
/* We always have the exact same format for every reducer we write, we always | |
have a switch statement and depending on the action it will decide what to | |
do with it. | |
we can never return undefined from a reducer, every time our reducers are call | |
we should have a default state. | |
*/ | |
switch (action.type) { | |
case: | |
// in step 11 | |
default: | |
// Return the initial state when no action types match. | |
return state | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment