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

const PageGood = ({ match: { params: { _id } }, getData }) => {
  useEffect(() => {
    getData(_id);
  }, [_id]);

  return (
    <CPromisePreloader name='goodById'>
      <GoodCardCharacteristic/>
    </CPromisePreloader>
  );
};

const CreatePageGood = connect(null, { getData: actionGoodById })(PageGood);

export default CreatePageGood;
