react.dev icon indicating copy to clipboard operation
react.dev copied to clipboard

Third-party packages using 'react/jsx-runtime' need to be explained when applied in Html

Open idler8 opened this issue 2 years ago • 0 comments
trafficstars

<script src="https://unpkg.com/react@18/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
<script>
    // I must use this method or I will get the error
    // Cannot read properties of undefined (reading 'jsx')
    window.jsxRuntime = { jsx: React.createElement }
</script>
<!-- Assume that the package is packaged using @babel/plugin-transform-react-jsx - runtime:automatic -->
<script src="https://unpkg.com/@idler8/[email protected]"></script>

<script src="https://unpkg.com/@babel/[email protected]/babel.min.js"></script>
<script type="text/babel">
 // ...
</script>

Excuse me, these English are translated from Chinese

idler8 avatar Mar 08 '23 04:03 idler8