What's the difference between forceUpdate setState?

what"s the difference between forceUpdate setState?
when to use forceUpdate?
solve?


sometimes your variables are not on the state, such as this.couter , etc. When these variables are changed to the React component, the render will not be re-executed, so you need the component to force the render method to be called.


forceUpdate skips the shouldComponentUpdate step to directly trigger the render method of the component
the official website suggests that forceUpdate should be avoided as much as possible

Normally you should try to avoid all uses of forceUpdate () and only read from this.props and this.state in render ().
https://reactjs.org/docs/reac.
Menu