Skip to content

Commit 5c76630

Browse files
committed
Update createAsyncThunk.mdx
1 parent 756f99c commit 5c76630

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

docs/api/createAsyncThunk.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ If you need to cancel a thunk before the payload creator is called, you may prov
372372
```js
373373
const fetchUserById = createAsyncThunk(
374374
'users/fetchByIdStatus',
375-
async (userId, thunkAPI) => {
375+
async (userId: number, thunkAPI) => {
376376
const response = await userAPI.fetchById(userId)
377377
return response.data
378378
},
@@ -494,7 +494,7 @@ import axios from 'axios'
494494

495495
const fetchUserById = createAsyncThunk(
496496
'users/fetchById',
497-
async (userId, { signal }) => {
497+
async (userId: string, { signal }) => {
498498
const source = axios.CancelToken.source()
499499
signal.addEventListener('abort', () => {
500500
source.cancel()
@@ -517,7 +517,7 @@ import { userAPI } from './userAPI'
517517

518518
const fetchUserById = createAsyncThunk(
519519
'users/fetchByIdStatus',
520-
async (userId, { getState, requestId }) => {
520+
async (userId: string, { getState, requestId }) => {
521521
const { currentRequestId, loading } = getState().users
522522
if (loading !== 'pending' || requestId !== currentRequestId) {
523523
return

0 commit comments

Comments
 (0)