I am working on a widget made in Next 13 with app route. This widget is a JSX component. I need it to be able to be used as an embedded JS in another company's project as follows:
<script src="https://my-url/my-component.js" type="text/javascript"></script>
<script type="text/javascript">
MyApp.init({
some: "config"
});
</script>
How could this be done?
I tried to create a file like:
import { createRoot } from 'react-dom/client'
import MyComponent from '@/app/components/MyComponent'
export const init = (container, param1, param2, param3) => {
createRoot(container).render(
<MyComponent
param1={param1}
param2={param2}
param3={param3}
/>
)
}