Fragment

Advertisement

We need to wrap all the child in one element.

To avoid the extra <div> we can use the Fragment.

import { Fragment } from 'react';

function App() {
	return (
		<Fragment>
			<h1>Heading 1</h1>
			<h2>Heading 2</h2>
			<h3>Heading 3</h3>
			<h4>Heading 4</h4>
			<h5>Heading 5</h5>
			<h6>Heading 6</h6>
		</Fragment>
	)
}

export default App;
%d bloggers like this: