Browse Source

fix slice() link (#4156)

main
bigfang 3 years ago
committed by GitHub
parent
commit
7d9c9e80d2
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      beta/src/pages/learn/updating-arrays-in-state.md

2
beta/src/pages/learn/updating-arrays-in-state.md

@ -35,7 +35,7 @@ Alternatively, you can [use Immer](#write-concise-update-logic-with-immer) which
<Gotcha>
Unfortunately, [`slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) and [`splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) are named similarly but are very different:
Unfortunately, [`slice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice) and [`splice`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice) are named similarly but are very different:
* `slice` lets you copy an array or a part of it.
* `splice` **mutates** the array (to insert or delete items).

Loading…
Cancel
Save