Answer the question
In order to leave comments, you need to log in
If the parent has shouldComponentUpdate return fasle, will nested elements be updated?
class someClass1 extends Component {
constructor(props) {
super(props);
this.props = props;
}
shouldComponentUpdate() {
return false;
}
render() {
return <div></div>
}
}
class someClass1 extends Component {
constructor(props) {
super(props);
this.props = props;
}
render() {
return <span></span>
}
}
<someClass1>
<someClass2/>
</someClass1>
Answer the question
In order to leave comments, you need to log in
If shouldComponentUpdate returns false, the render method of the current component will not be called. Accordingly, child components will also not start rendering themselves. But it may happen (for example - on a timer) that you call setState in the child component - then it will be updated (regardless of the parent)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question