Skip to content

Instantly share code, notes, and snippets.

@lakinmindfire
Created August 10, 2023 07:49
Show Gist options
  • Save lakinmindfire/8f25dc1400dfe0d00050243406559ad1 to your computer and use it in GitHub Desktop.
Save lakinmindfire/8f25dc1400dfe0d00050243406559ad1 to your computer and use it in GitHub Desktop.
single-spa example
// App1
const App1 = () => <div>App 1</div>;
export const bootstrap = [App1];
export const mount = [App1];
export const unmount = [App1];
// App2
const App2 = () => <div>App 2</div>;
export const bootstrap = [App2];
export const mount = [App2];
export const unmount = [App2];
// Shell
import { registerApplication, start } from 'single-spa';
registerApplication({
name: 'app1',
app: () => System.import('app1'),
activeWhen: ['/app1']
});
registerApplication({
name: 'app2',
app: () => System.import('app2'),
activeWhen: ['/app2']
});
start();
// Routing
<Router> <Route path="/app1" component={App1} /> <Route path="/app2" component={App2} /> </Router>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment