Why is React PureComponent recommended that all of its children be “clean,”

After reading the official React documentation , I came across a regarding PureComponent :

In addition, React.PureComponents shouldComponentUpdate () skips the update hint for the entire subtree of the component. Make sure all children components are also “clean.”

Why is it that skipping props updates for the entire subtree means eliminating unclean components? what would be the consequences of an unclean component inside the subtree of the PureComponent component (both in general and in the case when it was not designed / should respond to changes in props).

+6
source share
2 answers

, DOM. PureComponent, ​​state, context. PureComponents .

<MyApp>      
 <Router>    // react-router.
  <App>   // A PureComponent
   <Switch>  // react-router Switch
     <Route ....>
   </Switch>
  </App>
 </Router>
</MyApp>

React-routers Router . React-routers Route. App - , context , not using, . , PureComponent, , . , .

+2

. . . . : user.name = value. , , ?

0

All Articles