import { Dispatch } from 'redux' ; import { Product } from '../types' ; import { actions } from './constants' ; const addToCartSafe = ( product ) => ( { type : actions . ADD_TO_CART , payload : product } ) ; export const addToCart = ( product ) => ( dispatch , getState ) => { dispatch ( addToCartSafe ( product ) ) ; } ;