Skip to content

Commit c837f1d

Browse files
authored
Update part6b.md
Added implementation note for exercise 6.11 that would be hard for learners to troubleshoot.
1 parent 74fd049 commit c837f1d

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/content/6/en/part6b.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,22 @@ Also, start using Redux DevTools to debug the application's state easier.
713713
714714
Change also the definition of the <i>anecdote reducer and action creators</i> to use the Redux Toolkit's <em>createSlice</em> function.
715715
716+
Implementation note: when you use the Redux Toolkit to return the initial state of anecdotes, it will be immutable, so you will need to make a copy of it to sort it, or you will encounter "TypeError: Cannot assign to read only property '". You can use the spread syntax to make a copy of the array. Instead of:
717+
718+
```js
719+
720+
anecdotes.sort()
721+
722+
```
723+
724+
Write:
725+
726+
```js
727+
728+
[...anecdotes].sort()
729+
730+
```
731+
716732
#### 6.12 Better Anecdotes, step 10
717733
718734
The application has a ready-made body for the <i>Notification</i> component:

0 commit comments

Comments
 (0)