I'm trying to change a value from a select menu. My code is working, but I think this would go better if I used useReducer.Am I correct? I tried to change it, but I just can't seem to make it work... At the documentation it says that:
"useReducer is usually preferable to useState when you have complex state logic that involves multiple sub-values or when the next state depends on the previous one."
I think I should be using it right?
const [diametro, setDiametro] = useState(0);
const [total, setTotal] = useState("0");
useEffect(
() => setTotal(() => ((preco / 100) * diametro).toFixed(2).replace(".", ",")), [diametro]
);