You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/tutorials/essentials/part-5-async-logic.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ The project also includes a small HTTP API client object that exposes `client.ge
40
40
41
41
We'll use the `client` object to make HTTP calls to our in-memory fake REST API for this section.
42
42
43
-
Also, the mock server has been set up to reuse the same random seed each time the page is loaded, so that it will generate the same list of fake users and fake posts. If you want to reset that, delete the `'randomTimestampSeed'` value in your browser's Local Storage and reload the page, or you can turn that off by editing `src/api/server.js` and commenting out the `setRandom(rng)` call.
43
+
Also, the mock server has been set up to reuse the same random seed each time the page is loaded, so that it will generate the same list of fake users and fake posts. If you want to reset that, delete the `'randomTimestampSeed'` value in your browser's Local Storage and reload the page, or you can turn that off by editing `src/api/server.js` and setting `useSeededRNG` to `false`.
@@ -202,7 +202,7 @@ For more details on these arguments and how to handle canceling thunks and reque
202
202
203
203
:::
204
204
205
-
In this case, we know that the list of notifications is in our Redux store state, and that the latest notification should be last in the array. We can destructure the `getState` function out of the `thunkAPI` object, call it to read the state value, and use the `selectAllNotifications` selector to give us just the array of notifications. Then, to get the last item in the array, we can use `allNotifications.slice(-1)` to create a new array with just the last item, and destructure that. (It's a bit tricky, but also nicer to read than doing `allNotifications[allNotifications.length - 1]`.)
205
+
In this case, we know that the list of notifications is in our Redux store state, and that the latest notification should be first in the array. We can destructure the `getState` function out of the `thunkAPI` object, call it to read the state value, and use the `selectAllNotifications` selector to give us just the array of notifications. Since the array of notifications is sorted newest first, we can grab the latest one using array destructuring.
0 commit comments