ConstOptionalDefaultValue: TOptionalAccurateDependencyExecution: boolean = falseBy default, if your effect has multiple dependencies, You callback will execute only at the end of the frame and will only run once. Meaning if two dependent states changes at the same time, instead of running the function twice, it will run only once with the updated values being correct. However, setting this to true will make the function run twice, where the first function will see state1 be up to date but state2 not technically "updated", then another execution where both states are "updated".
If any State is called within your
Callback, it will rerun yourCallbackanytime that state changes.If you return a value from the first run of your effect, your effect will be "stateful", meaning it will return a
Statethat you can use like any other State. Whenever your effect runs again, the State will be updated to whatever value is returned.