DEV Community

Discussion on: Methods vs Computed in Vue

Collapse
drewclem profile image
Drew Clements

Exactly!

Another important thing to note is that computed properties are available the same as properties in your data store

So

data() {
  return {
    number: 1
  }
}
Enter fullscreen mode Exit fullscreen mode

is the same as

computed: {
  number() {
    return 1
  }
}
Enter fullscreen mode Exit fullscreen mode

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.

Thread Thread
adiatiayu profile image
Ayu Adiati Author

Thank you, Drew!!! 😃