Specifying Children with JSX

If a tag is empty, you may close it immediately with />, like XML:

const element = <img src={user.avatarUrl} />;

JSX tags may contain children:

const element = (

<div>

<h1>Hello!</h1>

<h2>Good to see you here.</h2>

</div>

);

Share this post
[social_warfare]
JavaScript Expressions
Styling in JSX

Get industry recognized certification – Contact us

keyboard_arrow_up