How to Avoid Array Mutation
Originally posted on dev.to
In this article, I’ll focus on showing how to add, edit and remove items in an array causing mutation and non-mutation ways.
One thing we need to keep in mind when writing code avoiding mutation is to return a new reference to the data after the update.
It’s a common approach when working with functional programming and if you want to understand some concepts of functional programming I recommend you read this article I wrote some time ago.