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

92
Views
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 answers
Answer question

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 Report
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!