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
Action creators that were generated using [`createAction`](./createAction.md) may be used directly as the keys here, using
39
-
computed property syntax. (If you are using TypeScript, you may have to use `actionCreator.type` or `actionCreator.toString()`
40
-
to force the TS compiler to accept the computed property.)
39
+
computed property syntax.
40
+
41
+
> **Note**: If you are using TypeScript, we recommend using the `builder callback` API that is shown below. If you do not use the `builder callback` and are using TypeScript, you will need to use `actionCreator.type` or `actionCreator.toString()`
42
+
> to force the TS compiler to accept the computed property. Please see [Usage With TypeScript](./../usage/usage-with-typescript.md#type-safety-with-extraReducers) for further details.
// action is inferred correctly here with `action.payload` as a `number`
107
+
return state + action.payload
108
+
})
109
+
}
110
+
})
111
+
```
112
+
113
+
WerecommendusingthisAPIifstrictertypesafety is necessary when defining reducer argument objects. It's particularly useful for working with actions produced by `createAction` and `createAsyncThunk`.
0 commit comments