import { useEffect } from "react";
import { useDispatch } from "react-redux";
import { setSelectedChartData } from "../../../../../redux/slices/selectedChartDataSlice";

const useChartData = (loopMeasurementCurveChartData: any) => {
  const dispatch = useDispatch();

  useEffect(() => {
    if (loopMeasurementCurveChartData) {
      dispatch(setSelectedChartData(loopMeasurementCurveChartData));
    }
  }, [loopMeasurementCurveChartData, dispatch]);
};

export default useChartData;
