简体   繁体   中英

reactjs forceUpdating another component

I have been using redux .. i am changing state tree using using redux actions ...

sometimes updating the state does not refresh the component .. i have to force update by this.forceUpdate() .. why is this happening? Under what condition does this happen.. usually updating state tree using an action automatically refreshes the component but sometimes it does not.. another question is that what if the state change needs to re-render a different component ?? how to i force update other components from another component ??

Are you sure what your return new object from your reducers? If your return the same object (only mutated) redux does not understand what data has changed.

If you need rerender component when data change that that component should be dependent on these data. forceUpdate is a really bad practice.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM