import React, {useEffect} from 'react';
import style from './favourite.module.sass';
import {getFavouriteGoods} from "../../../../../actions/actionCreator";
import {connect} from 'react-redux';
import FavouriteGoodsContainer from '../favourite/favouriteGoodsContainer/favouriteGoodsContainer';

const Favourite = (props) => {

    useEffect(() => {
        props.getFavouritesGoods();
    }, []);


    return(
      <div className={style.mainContainer}>
          <h1>Список желаний</h1>
          <FavouriteGoodsContainer/>
      </div>
    );
};

const mapStateToProps = state => {
  const {favouriteGoods} = state.favouriteGoodsReducers;

  return {
      favouriteGoods
  }
};

const mapDispatchToProps = dispatch => ({
   getFavouritesGoods: () => {dispatch(getFavouriteGoods())}
});

export default connect(mapStateToProps, mapDispatchToProps)(Favourite);