Skip to content

Instantly share code, notes, and snippets.

@rehrumesh
Created July 5, 2020 17:47
Show Gist options
  • Save rehrumesh/f2571a9367b7a6db62ebd73382aca333 to your computer and use it in GitHub Desktop.
Save rehrumesh/f2571a9367b7a6db62ebd73382aca333 to your computer and use it in GitHub Desktop.
Updated index.js of Cats micro frontend
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
window.renderCats = (containerId, history) => {
ReactDOM.render(
<App history={history} />,
document.getElementById(containerId),
);
serviceWorker.unregister();
};
window.unmountCats = containerId => {
ReactDOM.unmountComponentAtNode(document.getElementById(containerId));
};
if (!document.getElementById('Cats-container')) {
ReactDOM.render(<App />, document.getElementById('root'));
serviceWorker.unregister();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment