1.

Explain the dissimilarity between one-way data flow and two-way data binding? Which vue.js directive is used for each?

Answer»

The second one is preferable performance-wise since it uses the computed property. 

Computed property : 

  • saves us from putting too much logic in our templates which might MAKE them HARD to maintain 
  • is cached based on reactive dependency. If there is no CHANGE in the value of reactive data the previously cached value is used RATHER than recomputing the result which increases performance.  
  • allows us to reuse a logic if it is needed more than once in the template rather than repeating the logic everywhere 
  • is recommended for COMPLEX logic that includes reactive data 
  • Method invocation always evaluates the logic whether the reactive data changes or not rather than caching the result like a computed property. 


Discussion

No Comment Found

Related InterviewSolutions