I'm following Vue's getting started and I'm getting confused, tried CSS Tricks and Stack Overflow and still not understanding it in practice. Someo...
For further actions, you may consider blocking this person and/or reporting abuse
Methods are just static functions that run once called upon. You can pass in arguments, and they can return a value but are not required to.
Computed properties will update automatically once their dependencies change. They don't accept any arguments and must return a single value.
Watch functions allow you to monitor a single property and do stuff once it changes. They don't return any value.
That's the way I see it anyway. 🙂
When to use methods
When to use computed properties
When to use watchers
(source :) )
Dinos summary is a good one. I would add that methods only run on render (when the component updates) if used in the component template. Other wise they only run when explicitly called (like when bound to an event with v-on:click). Computed is just data that's based on other data; it recalculates whenever the data it's based on changes.
Thanks for the clarifications! ⭐⭐⭐⭐⭐