Loading a React component into html page

26 Views Asked by At

I am trying to load a html page on my browser which should have a React component embedded. I am using a CDN to access the React component. Inside the file that the CDN url contains, a function, which returns a React component, is defined and exported. I try to access that function in the html, using the syntax:

<body>
    <div id="my-div"></div>
    <script type='text-babel'>
        props = {}
        const chart = window.my_function(props) # Should return a react component
        ReactDOM.render(chart, document.getElementById("my-div"))
    </script>
</body>

where props is a filled js object, and react, reactDOM and the file itself are loaded in the header black above.

Where could i be going wrong? the webpage loads but it is completely empty

0

There are 0 best solutions below