InterviewHubPRO
Section Overview
Q388

Question 388 of 445

Part 11: Legacy Architecture, Migration Patterns & Historical Internals (354 - 445)

87%
React & Modern Frontend (445 Qs)•Part 11: Legacy Architecture, Migration Patterns & Historical Internals (354 - 445)

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().

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