I am using webpack and babel for building my app and app is building successfully in file bundle.js.
I have index.jsx file that has this code
import React from 'react';
import { render } from 'react-dom';
import App from './App';
render(<App />, document.getElementById('app'));
App component has bunch of other components loading up.
I have index.html file in the same app.
<html>
<head>
<meta charset="utf-8">
<title>My App</title>
</head>
<body>
<div id="app" />
<script src="public/bundle.js" type="text/javascript"></script>
</body>
</html>
I am opening index.html file from system directory, directly in browser and app is running fine.
What I want to do is to use bundle.js file and load my script in another html/javascript application, that run same application inside it.
I have found this Writing embeddable Javascript plugin with React & Webpack link that shows how he managed to use it.
Where he uses
export const init = (config) => {
ReactDOM.render(<MyReactApp config={config} />, someSelector);
}
How can I convert my index.jsx file so that can be used in another app, same way it is being used in answer of link given.