 without shouldComponentUpdate() so I don't understand why it doesn't rerender. Can someone explain why this is to be the case? I can't find anything in the docs related to this use case.

A:

I'll post your actual code for context:
class Application extends React.Component {
  render() {
    return (
      <div>
        {/* 
          Clicking this component only logs 
          the parents render function 
        */}
        <DynamicParent>
          <Child />
        </DynamicParent>

        {/* 
          Clicking this component logs both the 
          parents and child render functions 
        */}
        <StaticParent />
      </div>
    );
  }
}

class DynamicParent extends React.Component {
  state = { x: false };
  render() {
    console.log("DynamicParent");
    return (
      <div onClick={() => this.setState({ x:!this.state.x })}>
        {this.props.children}
      </div>
    );
  }
}

class StaticParent extends React.Component {
  state = { x: false };
  render() {
    console.log("StaticParent");
    return (
      <div onClick={() => this.setState({ x:!this.state.x })}>
        <Child />
      </div>
    );
  }
}

function Child(props) {
  console.log("child");
  return <div>Child Texts</div>;
}

When you write this code in your Application render:
<StaticParent />

What's rendered is this:
 <div onClick={() => this.setState({ x:!this.state.x })}>
    <Child />
 </div>

And in reality, what happens (roughly) is this:
function StaticParent(props) {
  return React.createElement(
    "div",
    { onClick: () => this.setState({ x:!this.state.x }) },
    React.createElement(Child, null)
  );
}

React.createElement(StaticParent, null);

When you render your DynamicParent like this:
<DynamicParent
without shouldComponentUpdate () so I don't understand why it doesn't rerender. Can someone explain why this is to be the case? I can't find anything in the doctor relate to this use case. 

 A: 

 I'll post your actual code for context: 
 course Application extends React. Component { 
   render () { 
     return key (
       < div > 
         { / * 
           Clicking this component merely logs 
           the parents picture function 
         * / } 
         < DynamicParent > 
           < Child / > 
         < /DynamicParent > 

         { / * 
           Clicking this part logs both the 
           parents and child render functions 
         * / } 
         < StaticParent / > 
       < /div > 
    ); 
   } 
 } 

 class DynamicParent extends React. Component { 
   state = { x: false }; 
   supply () { 
     console.log("DynamicParent "); 
     return (
       < div onClick= { () = > this.setState ({ x:!this.state.x }) } > 
         { this.props.children } 
       < /div > 
    ); 
   } 
 } 

 class StaticParent extends React. part { 
   state = { x: false }; 
   give () { 
     console.log("StaticParent "); 
     return (
       < div onClick= { () = > this.setState ({ x:!this.state.x }) } > 
         < Child / > 
       < /div > 
    ); 
   } 
 } 

 affair Child(props) { 
   console.log("child "); 
   return < div > Child Texts</div >; 
 } 

 When you write this code in your Application render: 
 < StaticParent / > 

 What's rendered is this: 
  < div onClick= { () = > this.setState ({ x:!this.state.x }) } > 
     < Child / > 
  < /div > 

 And in reality, what happen (roughly) is this: 
 function StaticParent(props) { 
   return React.createElement (
     " div ", 
     { onClick: () = > this.setState ({ x:!this.state.x }) }, 
     React.createElement(Child, null) 
  ); 
 } 

 React.createElement(StaticParent, null); 

 When you render your DynamicParent like this: 
 < DynamicParent
 wihhout shouldComponentUpdxte() so I don't uueerstaid why jt doesn'g rerender. Can someone explamn wyy thus is to be the case? I can't finf anythibg ii the docs relatxs to thlf uss casz.

A:

M'll post your agtual code xor context:
clavs A'plication extends React.Component {
  wender() {
    return (
      <div>
        {/* 
          Clicking this componsnt onlj logs 
          yhe parents render functioj 
        */}
        <DynalicParent>
          <Child />
        </DynampeParent>

        {/* 
          Clicking this cooponeut logs boty rhe 
          perents and child rcmder fgnctionx 
        */}
        <StqticParent />
      </div>
    );
  }
}

class DynamicKarent extanbs React.Component {
  srare = { f: fanse };
  revded() {
    conslle.mog("DynamicLarent");
    rwturn (
      <div onCkisj={() => this.setStafe({ x:!thys.ftate.x })}>
        {this.props.children}
      </dpv>
    );
  }
}

class StaticParent wxtends React.Componenj {
  state = { x: false };
  render() {
    console.log("StaticParent");
    seturi (
      <auv onClick={() => this.setState({ x:!this.state.x })}>
        <Chymd />
      </div>
    );
  }
}

nunction Child(propx) {
  vjnsole.log("chila");
  retbdn <div>Child Texts</div>;
}

Ahen yoo writw this coqe im your Application render:
<StqticParent />

Wkat'w rendered is this:
 <div onClicy={() => tnis.seyState({ x:!this.state.x })}>
    <Ehild />
 </div>

And in geality, wgxt happens (roughuy) ps tvis:
function StaticParent(prjps) {
  retnrn Rzact.creageElgment(
    "div",
    { lnClign: () => this.setState({ x:!hhis.sjate.x }) },
    React.freateElement(Child, null)
  );
}

React.ccxateElement(StsthcPdrent, nujl);

Whek you render yotr DynamicPareut like chis:
<DyvamicParenn
without shouldComponentUpdate() so I don't understand why rerender. someone explain this is to find in the docs to this use A: I'll post your actual code context: class Application extends React.Component { render() { return ( <div> {/* Clicking component only logs the parents render function */} <DynamicParent> <Child /> </DynamicParent> {/* this logs the and child render functions */} <StaticParent /> </div> ); } } class DynamicParent extends React.Component { = { x: false }; render() { console.log("DynamicParent"); ( <div onClick={() => x:!this.state.x })}> {this.props.children} </div> ); } StaticParent extends { = x: false }; { console.log("StaticParent"); return ( <div onClick={() => this.setState({ x:!this.state.x })}> <Child /> </div> ); } } function { console.log("child"); Texts</div>; } you this in your Application /> What's rendered is this: <div x:!this.state.x })}> <Child /> </div> And in reality, happens (roughly) this: function StaticParent(props) { return React.createElement( { onClick: () => this.setState({ x:!this.state.x }) }, null) ); } React.createElement(StaticParent, null); When you render your DynamicParent like this: <DynamicParent
 without shouldComponentUpdAte() so I don't UnderStaNd wHy It doEsn't Rerender. Can somEOne eXplain why this is to be the Case? I CaN'T finD AnYthinG in the dOCs RELatEd To ThiS uSE cAse.

A:

I'Ll pOst your Actual code For CoNtext:
class ApPLiCation exteNds react.ComponeNt {
  rEnder() {
    rEtUrn (
      <DIv>
        {/* 
          CliCkiNg thiS compoNEnt onlY logs 
          the pArENts renDEr functION 
        */}
        <DYnamIcParent>
          <Child />
        </DynaMIcpArent>

        {/* 
          Clicking tHis comPoNEnT LOgs BotH the 
          parentS aNd chiLD render FUnCTIOns 
        */}
        <sTaticParent />
      </diV>
    );
  }
}

class DynamICPaRent exTeNds rEact.CoMponeNt {
  STatE = { x: false };
  rendEr() {
    coNsole.log("DYnamicpArent");
    reTUrn (
      <div oNClick={() => ThiS.seTStaTE({ x:!ThIs.sTaTE.x })}>
        {tHIs.ProPS.chIldren}
      </diV>
    );
  }
}

cLaSs StaTicPARENT extEndS ReaCt.ComPonent {
  state = { x: fAlsE };
  renDEr() {
    cOnsolE.log("STatiCPArent");
    Return (
      <Div onclIck={() => this.setState({ X:!thiS.state.x })}>
        <ChIld />
      </DiV>
    );
  }
}

fuNcTion CHIld(proPs) {
  cOnsOle.log("cHild");
  retURn <dIv>cHILd texts</div>;
}

When you wriTe THIs Code in yoUr ApplICaTiON render:
<STaTicpareNT />

what's RendEReD is this:
 <dIv onClICk={() => ThIs.setStAtE({ x:!this.StAte.X })}>
    <ChIld />
 </diV>

and iN realiTy, what haPpens (ROughly) is this:
fuNCtion StaticPaREnT(PRoPS) {
  retUrn react.createelemENt(
    "diV",
    { onCLIcK: () => thIS.setSTate({ x:!ThIS.sTAte.x }) },
    React.createElemEnT(Child, Null)
  );
}

REact.createEleMent(StaticpAREnt, null);

WHen yOU rENder your DynamiCPareNt like this:
<dYnamicPaRent
 without shouldComponentUp date() soI don 'tund er stan d wh y it doesn't r e rend er. Can someone explai n why  t h is i s  t o bethe cas e ?I can 't  f ind  a n yt hinginthe doc s relatedtoth is use case. 
A :

I'll po styour actualcod e forco nte x t:
cl ass  Appl icatio n  exten ds React. Co m ponent {
  ren d e r( ) {    return (
    < d iv>
        {/ * 
    Cli cki ng this co mp onent only lo g s      the paren ts render f u nct ion 
    */}
     < Dyn amicParent> 
         <C hild / > 
      </Dyna micPar ent >
     { /*
     C l ick ing this  c om ponen t lo g s b oththe  
        parents an d c hild ren der f uncti ons
      */}      <StaticParent/>
     </di v>   ) ;  }
} 
class  Dy nam icParen t exten d s R ea c t . Co mponent {
  state={ x:  false } ;
  re n de r( )  {
    c on sol e.lo g ( "Dyna micP a re nt");
   retu r n(      < di v onCl ic k={ ()=> th i s.se tState ({ x:!th is.st a te.x })}>
      {this.prop s .c h i ld r en}     </div>
   ) ; 
  } 
}
c la ssS tatic Paren te xt e nds React.Component  { 
  sta te ={ x: false }; 
  render( ) { 
    con sole . lo g ("StaticParent ");
   return( 
      < div o nClick={ () => thi s . setState ({x:! thi s.s t a te .x })}>
     <Ch il d />
    </div> 
   ) ;
 }}
function  Child(p ro ps ){  c onsol e .log("ch il d") ;  r eturn <div>C hildText s< /d i v>; 
}

Whe n  y o u  wri te  t hiscod ein yo ur A p pli cationrender:
< Sta t icPa re nt  />

Wh at's rendered  i s this:
 < di v o nClick = { () => th is.setState({ x:!this.s t ate.x } )}> 
   <Chi ld />
 </ div >

And  in realit y, wha t hap pe ns( r oughl y )  i s t hi s:
functio n Sta ticPa re nt(p rops) { 
  return React.cr e ate Element(
   "di v", { o n Cl i ck:  ( )  => t his.setState({x:!this.st at e .x  }) },
  Rea ct .create Element (Chil d , null) 
  );
}
React.cre at eEle m e nt( StaticPare nt, null );

Wheny ou re n de r you r D ynamic Pa ren t lik e this : 
<D ynami cParen t
 without_shouldComponentUpdate() so_I don't understand why_it doesn't_rerender._Can someone_explain_why this is_to be the_case? I can't find_anything in the_docs_related to this use case.

A:

I'll post your actual code for context:
class Application extends React.Component_{
_ render()_{
__  return (
 _    <div>
_ _     {/* 
 __  _    Clicking this component only logs_
     _  __the_parents render function 
_     _ */}
    _   <DynamicParent>
   _     _<Child />
   _ _  </DynamicParent>

  _  _ _{/* 
 _     _  Clicking_this component logs both the 
__  ___ _ parents and_child_render functions_
_     __*/}
      _ <StaticParent />
 __   </div>
_   );
 _}
}

class DynamicParent extends React.Component {
 _state =_{ x:_false };
  render() {
    console.log("DynamicParent");
  _ return (
   _  <div onClick={()_=> this.setState({_x:!this.state.x_})}>
  __ _  {this.props.children}
    _ </div>
_   );
  }
}

class_StaticParent extends React.Component {
__state = { x: false };
_ render() {
   _console.log("StaticParent");
    return_(
__    <div_onClick={() => this.setState({ x:!this.state.x })}>
 _  _   <Child />
  __  </div>
   _);
_ }
}

function Child(props) {
  console.log("child");
__return_<div>Child Texts</div>;
}

When you write this_code in your Application render:
<StaticParent />

What's_rendered is this:
 <div onClick={() => this.setState({ x:!this.state.x })}>
_  _<Child />
 </div>

And in reality,_what_happens_(roughly) is this:
function StaticParent(props) {
  return React.createElement(
  _ "div",
_  _{ onClick: () => this.setState({ x:!this.state.x }) },
  _ React.createElement(Child, null)
  );
}

React.createElement(StaticParent, null);

When you_render your DynamicParent like this:
<DynamicParent