React Babel with React Fragment Create Page Elements

HTML Code

<!doctype html>

<html>
	<head>
		<title>Page Title</title>
		<meta charset="UTF-8">
		<meta name="viewport" content="initial-scale=1.0">
	</head>
<script crossorigin src="https://unpkg.com/react@16/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@16/umd/react-dom.development.js">
    </script>
<script src="https://unpkg.com/[email protected]/babel.min.js"></script>
	<body>
        
        <div id="root"></div>
</body>
</html>

React Babel JavaScript Code

<script type="text/babel">

const main = <React.Fragment>
<main>
<h1>My Blog</h1>
<h2>H2 Heading of Page</h2>
<article>
<h2>My First Blog</h2>
<p>This is Content of paragraph</p><p>This is Content of paragraph</p><p>This is Content of paragraph</p><p>This is Content of paragraph</p><p>This is Content of paragraph</p><p>This is Content of paragraph</p><p>This is Content of paragraph</p><p>This is Content of paragraph</p>
</article>
</main>
<footer>This is footer of Page</footer>
</React.Fragment>;
ReactDOM.render(main, document.getElementById('root'));

</script>

Output

Leave a Reply

Your email address will not be published. Required fields are marked *