Skip to content

Instantly share code, notes, and snippets.

@kiok46
Created June 10, 2018 10:49
Show Gist options
  • Save kiok46/923f1a5604319e232d320c3fe84049bb to your computer and use it in GitHub Desktop.
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)
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