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

91
Vistas
css not updating after re-redering component in redux react

I am trying to create a webpage using React. used redux for data access.

My problem is that when I click on any product, it shows me a perfect page, but if I go back and then again click on another product, my page shows me the data of the new product, but it does not change the photo height in CSS.

home page

product 1product 2(its doesnt changing first image height)

export const productDetailsReducer = (state = { product: {} }, action) => {

switch (action.type) {
    case PRODUCT_DETAILS_REQUEST:
        return {
            loading: true,
            ...state     <------i am sending the previous state
        }
    case PRODUCT_DETAILS_SUCCESS:
        return {
            loading: false,
            product: action.payload,
        }
    case PRODUCT_DETAILS_FAIL:
        return {
            loading: false,
            error: action.payload
        }
    case CLEAR_ERRORS:
        return {
            ...state,
            error: null
        }

    default:
        return state
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You must first iterate, and then provide the changes.

        return {
            ...state     <------ iterate
            loading: true, <----- set new values
        }

In addition, you should always iterate, just to make sure, you're not changing the whole state.

export const productDetailsReducer = (state = { product: {} }, action) => {

switch (action.type) {
    case PRODUCT_DETAILS_REQUEST:
        return {
            ...state
            loading: true,
        }
    case PRODUCT_DETAILS_SUCCESS:
        return {
            ...state,
            loading: false,
            product: action.payload,
        }
    case PRODUCT_DETAILS_FAIL:
        return {
            ...state,
            loading: false,
            error: action.payload
        }
    case CLEAR_ERRORS:
        return {
            ...state,
            error: null
        }

    default:
        return state
}
about 4 years ago · Juan Pablo Isaza Denunciar
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