import { Reducer } from "redux" ; import { BasketActions , BasketActionTypes , IBasketState } from "./BasketTypes" ; const initialBasketState = { products : [ ] } ; export const basketReducer = ( state = initialBasketState , action ) => { switch ( action . type ) { case BasketActionTypes . ADD : { return { ... state , products : state . products . concat ( action . product ) } ; } } return state || initialBasketState ; } ;