import { connect } from 'react-redux' ; import SellFormComponent from '../components/SellFormComponent' ; import { listItemAction } from '../actions/sellingItemAction' ; import { AppState } from '../index' ; import { AnyAction } from 'redux' ; import { ThunkDispatch } from 'redux-thunk' ; import { CategorySimple } from '../dataObjects/category' ; const mapStateToProps = ( state ) => { const categories = state . categories . categories . filter ( ( category ) => category . parentId !== 0 ) ; return { error : state . formError . error , categories , } ; } ; const mapDispatchToProps = ( dispatch ) => ( { sellItem : ( name , description , price , categoryId , image ) => { dispatch ( listItemAction ( name , description , price , categoryId , image ) ) ; } , } ) ; export default connect ( mapStateToProps , mapDispatchToProps ) ( SellFormComponent ) ;