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
* Allows you to match your incoming actions against your own filter function instead of only the `action.type` property.
72
-
* @remarks
73
-
* If multiple matcher reducers match, all of them will be executed in the order
74
-
* they were defined in - even if a case reducer already matched.
75
-
* All calls to `builder.addMatcher` must come after any calls to `builder.addCase` and before any calls to `builder.addDefaultCase`.
76
-
* @param matcher - A matcher function. In TypeScript, this should be a [type predicate](https://www.typescriptlang.org/docs/handbook/2/narrowing.html#using-type-predicates)
77
-
* function
73
+
* Wraps and adds a matcher reducer. This behaves like the original
74
+
* `builder.addMatcher` but also triggers the persistence callback
75
+
* upon execution.
76
+
* @param matcher - A matcher function to filter actions.
78
77
* @param reducer - The actual case reducer function.
79
-
*
80
-
* @example
81
-
```ts
82
-
import {
83
-
createAction,
84
-
createReducer,
85
-
AsyncThunk,
86
-
UnknownAction,
87
-
} from "@reduxjs/toolkit";
88
-
89
-
type GenericAsyncThunk = AsyncThunk<unknown, unknown, any>;
90
-
91
-
type PendingAction = ReturnType<GenericAsyncThunk["pending"]>;
92
-
type RejectedAction = ReturnType<GenericAsyncThunk["rejected"]>;
93
-
type FulfilledAction = ReturnType<GenericAsyncThunk["fulfilled"]>;
* Adds a case reducer to handle a single exact action type.
133
-
* @remarks
134
-
* All calls to `builder.addCase` must come before any calls to `builder.addMatcher` or `builder.addDefaultCase`.
135
-
* @param actionCreator - Either a plain action type string, or an action creator generated by [`createAction`](./createAction) that can be used to determine the action type.
85
+
* Wraps and adds a case reducer to handle a single action type. This
86
+
* behaves like the original `builder.addCase` but also triggers the
87
+
* persistence callback upon execution.
88
+
* @param actionCreator - The action creator or type stringto match against.
136
89
* @param reducer - The actual case reducer function.
0 commit comments