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

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

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 Report

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