Tell us what’s happening:
Navbar component in this example renders to the screen, while MyApp does not. Codes are similar, apart from Navbar being a child of MyApp.
What makes Navbar render to the screen?
This question is to provide me with better understanding of how React works. Thanks for your time.
where the first parameter is the root React component and the second parameter is where to render it - in this case it is looking in the HTML (also hidden from you at this point) for and element with the id of “root”.
Again, this is hidden from you at the moment, to make things smaller and easier to digest. You will learn it.
Navbar component in this example renders to the screen, while MyApp does not.
Why do you think MyApp doesn’t render. It does, it’s just that there is nothing there to see except for Navbar, it is just an invisible wrapper.
If you want to see it, you can change the _render_method in MyApp to:
Now it is more clear. Thank you.