Browse Source

Rephrase the reason for duplicating the array for clarity (#3889)

main
Pubudu Fernando 3 years ago
committed by GitHub
parent
commit
16f55e9d22
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      content/tutorial/tutorial.md

2
content/tutorial/tutorial.md

@ -524,7 +524,7 @@ Note how in `handleClick`, we call `.slice()` to create a copy of the `squares`
### Why Immutability Is Important {#why-immutability-is-important}
In the previous code example, we suggested that you use the `.slice()` method to create a copy of the `squares` array to copy instead of modifying the existing array. We'll now discuss immutability and why immutability is important to learn.
In the previous code example, we suggested that you create a copy of the `squares` array using the `slice()` method instead of modifying the existing array. We'll now discuss immutability and why immutability is important to learn.
There are generally two approaches to changing data. The first approach is to *mutate* the data by directly changing the data's values. The second approach is to replace the data with a new copy which has the desired changes.

Loading…
Cancel
Save