import { useEffect } from 'react';
import { connect } from 'react-redux';
import { actionSearchGood } from '../action';
import { GoodSearch } from '../components';
import { CPromisePreloader } from '../reducer';

const PageSearchGood = ({ match, match: { params: { value } }, searchGood }) => {
  console.log('search', match);
  useEffect(() => {
    searchGood(value);
  }, [value]);

  return (
    <CPromisePreloader>
      <GoodSearch value={value}/>
    </CPromisePreloader>
  );
};
const PageSearch = connect(null, { searchGood: actionSearchGood })(PageSearchGood);

export default PageSearch;
