Data vs Computed Properties
The main use-case difference for the data
and computed
properties of a Vue
instance is dependent on the potential state or probability of changing of the data. When deciding what category a certain object should be, these questions might help:
- Is this a constant value? (data)
- Does this have the possibility to change? (computed or data)
- Is the value of it reliant on the value of other data? (computed)
- Does it need additional data or calculations to be complete before being used? (computed)
- Will the value only change under certain circumstances? (data)