Components and how it is used

Can someone explain the difference between using <Navbar></Navbar> and <Navbar /> Component?

<Navbar /> is self closing. Simply put, if the component doesn’t have children, then this is generally the syntax we use.

If a component does have children, then those will be nested within the component

I am a child of Navbar

You can still use <Navbar></Navbar>, there’s no harm in doing so, it’s just generally preferred to use a self closing tag as it’s cleaner.

1 Like

Thanks James. My head scratching has stopped atlast :sweat_smile:

1 Like