Question - What do you understand by the array detection non-mutation methods?
Answer -
The methods that do not mutate the original array but always return a new array are known as non-mutation methods.
Following is a list of the non-mutation methods:
- filter() method
- concat() method
- slice() method
Let's take an example to understand it better. We have a todo list replacing the old array with a new one based on the status filter.
Example:
vmvm.todos = vm.todos.filter(function (todo) {
return todo.status.match(/Completed/)
})
This approach would not re-render the entire list due to Vue.js implementation.