title: How to export ReactJS app as package to be used in other app?
body: <p>I am using <strong>webpack</strong> and <strong>babel</strong> for building my app and app is building successfully in file bundle.js.</p>
  
  <p>I have index.jsx file that has this code</p>
  
  <pre><code>import React from 'react';
  import { render } from 'react-dom';
  import App from './App';
  
  render(&lt;App /&gt;, document.getElementById('app'));
  </code></pre>
  
  <p>App component has bunch of other components loading up.</p>
  
  <p>I have index.html file in the same app. </p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;meta charset="utf-8"&gt;
      &lt;title&gt;My App&lt;/title&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;div id="app" /&gt;
      &lt;script src="public/bundle.js" type="text/javascript"&gt;&lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>I am opening index.html file from system directory, directly in browser and app is running fine.</strong></p>
  
  <p>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.</p>
  
  <p>I have found this <a href="https://stackoverflow.com/questions/37239731/writing-embeddable-javascript-plugin-with-react-webpack">Writing embeddable Javascript plugin with React &amp; Webpack</a> link that shows how he managed to use it. </p>
  
  <p>Where he uses</p>
  
  <pre><code>export const init = (config) =&gt; {
    ReactDOM.render(&lt;MyReactApp config={config} /&gt;, someSelector);
  }
  </code></pre>
  
  <p>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.</p>