1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Building a Tree of UI Components in React with Children or with Self-closing tags

    reactReact

    You can reuse your custom react components multiple times and build them into a tree of components like this:

    <Greeting />
    <div>
      <Greeting />
    </div>

    Notice that the <div> tag contains the Greeting tag as a child, but the Greeting tag contains no children - so it requires the trailing slash (/>) so it can be a "self closing" tag