11 <div className="box">
12
13 </div>
14 <div className="box2">15
16 </div>
17 </div>
8
9 <div className={"login-card"}>
10 <div className="feather-container">
11 <div className="box">12
13 </div>
14 <div className="box2">
Components without children can be self-closed to avoid the unnecessary extra closing tag. In JSX, closing tags are required when the component has children example <MyComponent>...</MyComponent>
and if there are no child component between these tags, then this component can be self closed using <MyComponent />
. It is recommended as it improves readability, and it is more compact to use self-closing for these types of components.
var HelloJohn = <Hello name="John"></Hello>;
var HelloJohnCompound = <Hello.Compound name="John"></Hello.Compound>;
var HelloJohn = <Hello name="John" />;
var HelloJohnCompound = <Hello.Compound name="John" />;