0 votes
in ReactJS by

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

1 Answer

0 votes

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

Related questions

0 votes
asked Mar 1, 2020 in ReactJS by RShastri
0 votes
asked Aug 22, 2019 in Selenium by john ganales