22 lines
634 B
TypeScript
22 lines
634 B
TypeScript
// components/main/kabelueberwachung/kue705FO/hooks/useLoopDisplay.ts
|
|
import { useEffect, useState } from "react";
|
|
|
|
const useLoopDisplay = (
|
|
schleifenwiderstand: number,
|
|
activeButton: "Schleife" | "TDR" | "ISO"
|
|
) => {
|
|
const [loopDisplayValue, setLoopDisplayValue] =
|
|
useState<number>(schleifenwiderstand);
|
|
|
|
useEffect(() => {
|
|
if (activeButton === "Schleife") {
|
|
setLoopDisplayValue(schleifenwiderstand);
|
|
}
|
|
// For ISO and TDR, the value is set manually via setLoopDisplayValue
|
|
}, [schleifenwiderstand, activeButton]);
|
|
|
|
return { loopDisplayValue, setLoopDisplayValue };
|
|
};
|
|
|
|
export default useLoopDisplay;
|