Dewen Li

A site about Dewen

Load React in HTML Template

2021-02-20 Dewen Liweb-development

Load React in HTML template.

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
    <h1>ReactDom in browser</h1>
    <div id="app"></div>
    <script src="https://unpkg.com/react@16/umd/react.development.js"></script>
    <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js"></script>
    <script src="my_app.js"></script>
    <script>
      const content = React.createElement('h2', '', 'my content');
      ReactDOM.render(content, document.getElementById('app'));
    </script>
</body>
</html>