Derive state intelligently with computed properties.
1What is a Computed Property?
A computed property allows you to define a property that is used the same way as data, but can also have some custom logic that is evaluated to get its value. It is defined using the computed() function.
2The Magic of Caching
The main difference between a computed property and a normal function is caching. A computed property only re-evaluates when its reactive dependencies change. If you call a computed property 100 times, the logic only runs once, saving CPU cycles.
3Read-Only by Default
Computed properties should be treated as derived state, meaning you shouldn't mutate them directly. They are essentially 'getters'. (Though Vue does allow you to define writable computed properties by providing a set() function if truly needed).
