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

145
Vistas
How does redux decide when to update the UI?

By design when the state updates the UI should update.

However. If I return a brand new object, it will not update the UI.

  case 'clearArticleForm':
    let newState1 = {};
    return newState1;
  }

If I return a brand new object and populate it as follows I still can not get the UI to update.

const initial_state = {link:{}, image:{}, title:{}, summary:{}, tag:{}, domain:{}, valid: false};


  case 'clearArticleForm':
    let newState1 = initial_state;
    return newState1;
  }

However if I populate it this way, I will finally get the UI to update.

const initial_state = {link:{value:''}, image:{value:''}, title:{value:''}, summary:{value:''}, tag:{value:''}, domain:{value:''}, valid: false};

  case 'clearArticleForm':
    let newState1 = initial_state;
    return newState1;
  }

I though that by definition / design when the state changes the UI should update. What is going on here.

The state changes as I verified in the functional component however the UI does not until the 3rd example.

I have described the behavior for this case however I am looking for a rule and documentation so I understand the general case: induction.

Functional Component:

const data = useSelector((state) => state.ArticleForm) || {};

// ... snip

<M10 valid = {data.link.valid}     value = {data.link.value}    onChange={onChange} className = 'modal_article_input' placeholder="link"    name="link" />
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Although the state is updating, that state must actually be used in your returned JSX

For example, if you are watching a part of the state tree in your functional component but do not use that part of the tree in your component, that UI will not update.

about 4 years ago · Juan Pablo Isaza Denunciar

0

In your middle code snippet your state has keys and their values are empty objects.

const initial_state = {link:{}, image:{}, title:{}, summary:{}, tag:{}, domain:{}, valid: false};

but in the last one these objects has keys and values.

const initial_state = {link:{value:''}, image:{value:''}, title:{value:''}, summary:{value:''}, tag:{value:''}, domain:{value:''}, valid: false};

can this be the reason for not updating the render?

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