Can you force a component to re-render without calling setState?

Posted by Prem Tiwari | Updated on

Can you force a component to re-render without calling setState?

By default, when your component’s state or props change, your component will re-render. If your render() method depends on some other data, you can tell React that the component needs re-rendering by calling forceUpdate().

It is recommended to avoid all uses of forceUpdate() and only read from this.props and this.state in render().


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers