Could someone provide a example of using ```useEff...
# react
d
Could someone provide a example of using
Copy code
useEffectWithCleanup
to fire only when I have a specific state change. For example, I want the cleanup to happen only when my submitted state changes.
d
Thanks. In the end it seems that my issue is actually that state values only have their initial state within the cleanup. I therefore had to set a local variable/flag on the state change cleanup and then use that flag to control logic in clean up with no dependencies