You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm new to Vue but have angualarJS (aka angular 1) experience and back then, anything outside of the angular scope had to be brought back into the scope for reactivity. setTimout and XHR calls were notorious for this and could get unwieldy.
Is this not an issue for VueJS anymore? My first instict was to search for setTimeout, but there are no results.
The text was updated successfully, but these errors were encountered:
@michaelCTS
In Vue.js, you don’t need to manually bring things "back into scope" for reactivity, as Vue's reactivity system handles this much more smoothly. Vue uses a reactive data model, automatically tracking changes and propagating to the DOM.
In this example, Vue automatically tracks changes to the message, so when setTimeout updates this.message, the DOM will update as well. There's no need to trigger a scope digest manually.
Note: Since setTimeout is a core function of JavaScript, you can use it directly in Vue components.
Thanks for explaining @mahmudunnabikajal. I had a look at How reactivity works and understand it better now. Getters, setters and proxies didn't exist back in the days of angularjs / angular 1. Things sure have changed.
Maybe it could be useful to add a sentence to the linked document? Something along the lines of
Thanks to features introduced in ES6, dirty checks due to setTimeout and XHMLHttpRequest`, like in frameworks of old for example AngularJs (v1 of Angular), are no longer necessary.
I'm new to Vue but have angualarJS (aka angular 1) experience and back then, anything outside of the angular scope had to be brought back into the scope for reactivity.
setTimout
and XHR calls were notorious for this and could get unwieldy.Is this not an issue for VueJS anymore? My first instict was to search for
setTimeout
, but there are no results.The text was updated successfully, but these errors were encountered: