Another way to look at computed is that they can be used as dynamic data for every render.
Methods are functions that can be called as normal JS functions, but computed properties will be βre-calculatedβ anytime some data changes in the component.
Another way to look at computed is that they can be used as dynamic data for every render.
Methods are functions that can be called as normal JS functions, but computed properties will be βre-calculatedβ anytime some data changes in the component.
Thanks, Drew!
So computed is more like a method to update data to be dynamic?
When would we want to use methods or computed?
Exactly!
Another important thing to note is that computed properties are available the same as properties in your data store
So
is the same as
Both would be available with using
this.number
or{{ number }}
But, if you ever needed number to update based on something else in the component, then the computed would do it auto-magically.
Thank you, Drew!!! π