In Vue.js, the watch
function gets the new and old watched value passed as arguments, which is really helpful in case the differences matter, or when I want to release the previous allocated resource.
Now in Angular 16, we finally have signal
, computed
, and effect
. effect()
seems to be the equivalent of the watch in Vue.js. But is it there also possible to get access to the old value?
The Angular API docs only mention onCleanup
. As effect
does not operate on an expression as in Vue, it might not be possible to store a previous value in a generic way.
Is there a workaround?