UseEffect not being called
Hey,
I've got a weird bug in my react component
For some reason, when
For example if i start the broker, it console logs
its almost as if the useEffect is reading the previous state.
However if i change the depedency to be my
( was previously wrapping the return in react.memo but i have removed it for this example, as it presents the same issue, the depedency of
I've got a weird bug in my react component
For some reason, when
mqtt.connected is changed the useEffect is not called.For example if i start the broker, it console logs
false and then when i disconnect it console logs trueits almost as if the useEffect is reading the previous state.
However if i change the depedency to be my
connected state variable instead, it updates perfectly....( was previously wrapping the return in react.memo but i have removed it for this example, as it presents the same issue, the depedency of
mqtt?.connected doesnt get called)