-
Hi! We've got few thunks, that do pretty much the same in terms of extra reducers, but we rather keep them separated, as they cover different scenarios and got different sets of props. Here's what it looks like right now: // register and registerExternal are just createAsyncThunk with Axios
builder.addCase(register.pending, (state, action) => {
state.fetchingData = true;
});
builder.addCase(registerExternal.pending, (state, action) => {
state.fetchingData = true;
}); And here's my imagination of what it could look like builder.addCase([register.pending, registerExternal.pending], (state, action) => {
state.fetchingData = true;
}); Is something like this achievable in Redux Toolkit? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Yes, with builder.addMatcher(isAnyOf(register.pending, registerExternal.pending), (state, action) => {
state.fetchingData = true;
}); |
Beta Was this translation helpful? Give feedback.
Yes, with
addMatcher
and isAnyOf