A top-level App component returns <Button /> from its render() method.
-
What is the relationship between
<Button />andthisin thatButton’srender()? -
Does rendering
<Button><Icon /></Button>guarantee that anIconmounts? -
Can the
Appchange anything in theButtonoutput? What and how?
<Button />is a virtual DOM element (represented in JSX here), butthisinButton'srender()method refers to the instance of theButtoncomponent, which is different. Components have arender()method which returns elements.Buttoncomponent could chose not to render its children.Appcould write to some really gross global variables that theButtonuses to decide what to render. Also, theAppcould pass props to theButton, which could influence theButtons output, ifButtonis written that way.