import * as React from 'react' ; import { BasketData , BasketItem } from '../' ; const BasketContext = React . createContext < BasketData > ( { items : [ ] , onAllItemsDeleted : ( ) => { } , onItemAdded : ( id ) => { } , onItemDeleted : ( id ) => { } } ) ; const withBasketData = < T extends { } > ( Wrap ) => ( props ) => { return ( < BasketContext . Consumer > { ( basketData ) => ( < Wrap basketData = { basketData } { ... props } />)} < /BasketContext.Consumer>); } ; export { BasketContext , withBasketData } ;