Last active
July 25, 2021 06:31
-
-
Save MeetMartin/6b21f799339931cc5fdfa8074424fe10 to your computer and use it in GitHub Desktop.
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 characters
// src/store/reducers.js | |
import types from "./types"; | |
const initialState = { | |
quote: 'Creativity is intelligence having fun.', | |
author: 'Albert Einstein' | |
}; | |
const reducer = (state = initialState, action) => { | |
console.debug('[reducer]', action.type); | |
switch (action.type) { | |
case(types.RECEIVE_RANDOM_QUOTE): | |
return ({ | |
...state, | |
quote: action.payload.quote, | |
author: action.payload.author | |
}); | |
default: | |
return state; | |
} | |
}; | |
export { initialState, reducer }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment