Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { combineReducers } from "redux";
- import types from "./types";
- /* State Shape
- {
- quacking: bool,
- distance: number
- }
- */
- const quackReducer = ( state = false, action ) => {
- switch( action.type ) {
- case types.QUACK: return true;
- /* ... */
- default: return state;
- }
- }
- const distanceReducer = ( state = 0, action ) => {
- switch( action.type ) {
- case types.SWIM: return state + action.payload.distance;
- /* ... */
- default: return state;
- }
- }
- const reducer = combineReducers( {
- quacking: quackReducer,
- distance: distanceReducer
- } );
- export default reducer;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement