Currently, I am in the process of developing a webpage using React and have implemented redux for data access.
However, I have encountered an issue where clicking on a product displays the correct page, but when navigating back and selecting a different product, the data updates correctly but the photo height in CSS remains unchanged.
Product 1Product 2 (photo height does not update)
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
}