Articles → REACT.JS → Write React Code Directly Into Your HTML File
Write React Code Directly Into Your HTML File
Code
<!DOCTYPE html>
<html>
<head>
<script src="https://unpkg.com/react@16/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js"></script>
<script src="https://unpkg.com/babel-standalone@6.15.0/babel.min.js"></script>
</head>
<body>
<div id="mydiv"></div>
<script type="text/babel">
class HelloGyansangrah extends React.Component {
render() {
return <h1>Hello Gyansangrah!</h1>
}
}
ReactDOM.render(<HelloGyansangrah />, document.getElementById('mydiv'))
</script>
</body>
</html>
Output
Click to Enlarge