Answers for "HTML to react"

0

React Directly in HTML

<!DOCTYPE html>
<html>
  <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/[email protected]/babel.min.js"></script>
  <body>
  
    <div id="mydiv"></div>

    <script type="text/babel">
      class Hello extends React.Component {
        render() {
          return <h1>Hello World!</h1>
        }
      }

      ReactDOM.render(<Hello />, document.getElementById('mydiv'))
    </script>
  </body>
</html>
Posted by: Guest on February-01-2021
5

html to jsx

1) Option One: Online
https://magic.reactjs.net/htmltojsx.htm
or
https://transform.tools/html-to-jsx

2) Option Two: System (assuming you have npm)
npm install html-to-jsx
Posted by: Guest on February-23-2020

Browse Popular Code Answers by Language