React force update to the whole component tree

Sometimes in order to improve performance, you might consider using this.forceUpdate() within a react component.
this will force an update to the whole tree below this component to render, without checking if there were actually any changes.

use it with caution, and only when you are sure that the whole tree should re-render. for instance when you have a large table, and you allow a user to change which columns are visible. you know for sure that all rows should re-render, so you can help React, by telling it to skip the dirty checking, and simply re-render the whole thing. it drastically improves performance in this case.

Leave a Reply

Your email address will not be published. Required fields are marked *