Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

537
Vistas
Dispatching action in thunk results in error: can't get state of undefined

Here is the action itself:

import actionFromAnotherReducer from '../subfolder/reducer'

export const asyncAction = createAsyncThunk(
  'reducerName/actionName',
  async(
    data,
    { dispatch, getState }
  ) => {
    return somePromise.then(response => {
      dispatch(actionFromAnotherReducer(response))
    })
  }
)

And here is where I get this error Cannot read properties of undefined (reading 'getState'): The above error occurred in the <Provider> component. The thing is when I remove the dispatch(action), everything works, and also if I dispatch an action from the same folder reducer, it works as well. How to fix it?

about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda