html to react code example
Example 1: 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
Example 2: 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>