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
Note that the payload passed to the handler may be of the type of any of the
282
-
listed action types' payloads. In TypeScript terms, this means it has type `P1 |
283
-
P2 | ...`, where `P1, P2, ...` are the payload types of the listed action
308
+
listed action types' payloads. In TypeScript terms, this means it has type `P1 | P2 | ...`, where `P1, P2, ...` are the payload types of the listed action
284
309
creators.
285
310
286
311
The payload type is inferred automatically for up to four action types. After
287
312
that, it must be supplied as a type annotation, for example:
Mutates the reducer such that it applies `handler` when no previously added `.case()`, `.caseWithAction()`, etc. matched.
307
-
The handler is similar to the one in `.caseWithAction()`.
308
-
Note that `.default()` ends the chain and internally does the same as [`.build()`](#build), because it is not intended that the chain is mutated after calling `.default()`.
334
+
Produces a reducer which applies `handler` when no previously added `.case()`,
335
+
`.caseWithAction()`, etc. matched. The handler is similar to the one in
336
+
`.caseWithAction()`. Note that `.default()` ends the chain and internally does
337
+
the same as [`.build()`](#build), because it is not intended that the chain be
338
+
mutated after calling `.default()`.
309
339
310
-
This is especially useful if you have a nested reducer for some property, that you need to call from the parent reducer on any action:
340
+
This is useful if you need a "delegate" reducer should be called on any action
341
+
after handling a few specific actions in the parent.
311
342
312
-
```
343
+
```ts
313
344
const NESTED_STATE = {
314
345
someProp: "hello",
315
346
};
@@ -355,7 +386,7 @@ There are two reasons you may want to do this:
0 commit comments