A top-level App
component returns <Button />
from its render()
method.
-
What is the relationship between
<Button />
andthis
in thatButton
’srender()
? -
Does rendering
<Button><Icon /></Button>
guarantee that anIcon
mounts? -
Can the
App
change anything in theButton
output? What and how?
<Button />
is a virtual DOM element (represented in JSX here), butthis
inButton's
render()
method refers to the instance of theButton
component, which is different. Components have arender()
method which returns elements.Button
component could chose not to render its children.App
could write to some really gross global variables that theButton
uses to decide what to render. Also, theApp
could pass props to theButton
, which could influence theButton
s output, ifButton
is written that way.