Redux ToolKit: is it possible to dispatch other actions from the same slice in one action created by createAsyncThunk

Possibly it’s not actual and the question is outdated, but there is thunkAPI as second parameter in payload creator of createAsyncThunk, so it can be used like so

export const updateData = createAsyncThunk('data/update', async (params, {dispatch}) => {
  const result = await sdkClient.update({ params })
  dispatch(getData())
  return result
})

Leave a Comment