I am trying to use react component in javascript project. I follow the these steps mentions in below links
https://www.fabiofranchino.com/blog/create-react-reusable-components-library-with-microbundle/
import ReactDOM from "react-dom"
import React from "react"
import {A} from "../components/sub/A";
export const Abc = ()=>{
console.log('---ddd')
console.log('---React',React)
console.log('---ReactDOM',ReactDOM)
console.log('---rootEl',document.getElementById("demo-test"))
ReactDOM.render(<A/>, document.getElementById("demo-test"))
}
window.Abc = Abc;
window.React = React;
window.ReactDOM = ReactDOM;
I used the bundle in javascript project . but getting react and react DOM undefined . when I call window.Abc()
<!DOCTYPE html>
<html>
<head>
<title>Parcel Sandbox</title>
<meta charset="UTF-8" />
<script
crossorigin
src="https://unpkg.com/react@18/umd/react.production.min.js"
></script>
<script
crossorigin
src="https://unpkg.com/react-dom@18/umd/react-dom.production.min.js"
></script>
</head>
<body>
<div id="demo-test"></div>
<script src="src/index.js"></script>
</body>
</html>
I already included React and React DOM library
here is my code https://codesandbox.io/s/eloquent-brahmagupta-24iniq?file=/index.html