Wrapping Elements

Consider a situation where you want to render multiple tags at a time. To do this we need to wrap all of this tag under a parent tag and then render this parent element to the HTML. All of the subtags are called child tags or child of this parent element.

If we want to return more elements, we need to wrap it with one container element. Notice how we are using div as a wrapper for h1, h2 and p elements.

App.jsx

import React from ‘react’;

class App extends React.Component {

render() {

return (

<div>

<h1>Header</h1>

<h2>Content</h2>

<p>This is the content!!!</p>

</div>

);

}

}

export default App;

Attributes
Comments in JSX

Get industry recognized certification – Contact us

keyboard_arrow_up