import { useState, useEffect } from "react";
import { useSelector } from "react-redux";

export function useIsPriceToHigh(priceBorder) {
  const currentConfigCost = useSelector((state) => state.cost);
  const [isPriceToHigh, setIsPriceToHigh] = useState(false);

  useEffect(() => {
    // null;
    setIsPriceToHigh(currentConfigCost > priceBorder);

  }, [currentConfigCost, priceBorder]);

  return [isPriceToHigh];
}
