Learning the difference between methods and computed properties
During my career, I have seen many people misusing methods and computed properties. In this section, we are going to clarify the difference between the two features and provide you with a guide that you can revisit during the course of your early career.
Technical differences
It may be a good starting point to re-iterate what we discussed in the previous two sections and see side by side what the technical differences are between these two Vue.js features:
Figure 5.5: A table showing the technical differences between methods and computed properties
Let’s focus on some of the main differences displayed in Figure 5.5:
- Time of initialization: Methods can be initialized on demand by the user, while computed properties are triggered during the component creation life cycle.
- Parameters and dependencies: While methods can accept parameters, computed properties can just use...