Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

215
Views
React, Redux: TypeError no capturado: no se pueden leer las propiedades de undefined (leyendo 'región')

Estoy obteniendo datos (un objeto) en un estado redux y mostrándolos en el área de texto cuando el usuario hace clic en editar:

 const regionData = useSelector((state) => state.myReducer.userDetailList.region);

pero la primera vez me da el siguiente error:

 Uncaught TypeError: Cannot read properties of undefined (reading 'region')

también ocurrió este error cuando cambié el código según la sugerencia de eslint:

 ie Use an object spread instead of `Object.assign` eg: `{ ...foo }`

Código antiguo:

 return Object.assign({}, state, { userDetailList: { region: action.userDetailsPayload.region, }, });

Nuevo código:

 const userDetailList = { region: action.userDetailsPayload.region, }; return { ...state, ...userDetailList };

Como resultado, userDetailList se muestra como EN BLANCO en Chrome redux-devtool. está funcionando con código antiguo (Object.assign)

Soy nuevo en reaccionar y redux, por lo que cualquier ayuda es muy apreciada. ¡Gracias!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!