• Home
  • Recent Q&A
  • Java
  • Cloud
  • JavaScript
  • Python
  • SQL
  • PHP
  • HTML
  • C++
  • Data Science
  • DBMS
  • Devops
  • Hadoop
  • Machine Learning
in Vue.JS by
Q:
What are the array detection non-mutation methods in VueJS?

1 Answer

0 votes
by

The methods which do not mutate the original array but always return a new array are called non-mutation methods. Below are the list of non-mutation methods,

filter()

concat()

slice()

For example, lets take a todo list where it replaces the old array with new one based on status filter,

vm.todos = vm.todos.filter(function (todo) {

  return todo.status.match(/Completed/)

})

This approach won't re-render the entire list due to VueJS implementation.

Related questions

0 votes
asked Feb 4, 2020 in Vue.JS by rajeshsharma
0 votes
asked Feb 4, 2020 in Vue.JS by rajeshsharma
...