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
Ifyouneedtocustomizethecreationofthepayloadvalueofanactioncreatorbymeansofa [`prepare callback`](./createAction.mdx#using-prepare-callbacks-to-customize-action-contents), thevalueoftheappropriatefieldofthe`reducers`argumentobjectshouldbeanobjectinsteadofafunction. This object must contain two properties: `reducer` and `prepare`. The value of the `reducer` field should be the case reducer function while the value of the `prepare` field should be the prepare callback function:
109
110
110
111
```ts
111
-
import { createSlice, PayloadAction, nanoid } from '@reduxjs/toolkit'
112
+
import { createSlice, nanoid } from '@reduxjs/toolkit'
113
+
import type { PayloadAction } from '@reduxjs/toolkit'
112
114
113
115
interface Item {
114
116
id: string
@@ -224,7 +226,8 @@ for references in a larger codebase.
224
226
## Examples
225
227
226
228
```ts
227
-
import { createSlice, createAction, PayloadAction } from '@reduxjs/toolkit'
229
+
import { createSlice, createAction } from '@reduxjs/toolkit'
230
+
import type { PayloadAction } from '@reduxjs/toolkit'
228
231
import { createStore, combineReducers } from 'redux'
Copy file name to clipboardExpand all lines: docs/api/matching-utilities.mdx
+18-10
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,8 @@ Accepts the same inputs as `isAllOf` and will return a type guard function that
48
48
A higher-order function that returns a type guard function that may be used to check whether an action was created by [`createAsyncThunk`](./createAsyncThunk).
@@ -65,7 +66,8 @@ function handleRequestAction(action: AnyAction) {
65
66
A higher-order function that returns a type guard function that may be used to check whether an action is a 'pending' action creator from the `createAsyncThunk` promise lifecycle.
@@ -82,7 +84,8 @@ function handlePendingAction(action: AnyAction) {
82
84
A higher-order function that returns a type guard function that may be used to check whether an action is a 'fulfilled'' action creator from the `createAsyncThunk` promise lifecycle.
@@ -99,7 +102,8 @@ function handleFulfilledAction(action: AnyAction) {
99
102
A higher-order function that returns a type guard function that may be used to check whether an action is a 'rejected' action creator from the `createAsyncThunk` promise lifecycle.
@@ -116,7 +120,8 @@ function handleRejectedAction(action: AnyAction) {
116
120
A higher-order function that returns a type guard function that may be used to check whether an action is a 'rejected' action creator from the `createAsyncThunk` promise lifecycle that was created by [`rejectWithValue`](./createAsyncThunk#handling-thunk-errors).
0 commit comments