I am trying to implement a logic where I need to perform an action every time a component uses setMyState(value) (where I note the previous value of the state as preValue) using the useEffect() hook with myState as a dependency.
This works as I want when value !== prevValue. However, if value === prevValue, the hook doesn't trigger, which is logical in term of optimization. But what would be the correct way to still trigger the hook at each setMyState(value) call ? It may be a design flaw as I'm quite new to React.
Thank you in advance.