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


Picture showing the output of react code written directly into HTML

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Thursday, July 29, 2021

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250