single-spa-inferno is a helper library that helps implement single-spa registered application lifecycle functions (bootstrap, mount and unmount) for for use with Inferno. Check out the single-spa-inferno github.

Quickstart

First, in the application, run npm install --save single-spa-inferno. Then, add the following to your application’s entry file.

  1. import Inferno from 'inferno';
  2. import rootComponent from './path-to-root-component.js';
  3. import singleSpaInferno from 'single-spa-inferno';
  4. const infernoLifecycles = singleSpaInferno({
  5. Inferno,
  6. createElement,
  7. rootComponent,
  8. domElementGetter: () => document.getElementById('main-content'),
  9. });
  10. export const bootstrap = infernoLifecyles.bootstrap;
  11. export const mount = infernoLifecyles.mount;
  12. export const unmount = infernoLifecyles.unmount;

Options

All options are passed to single-spa-inferno via the opts parameter when calling singleSpaInferno(opts). The following options are available:

  • inferno: (required) The main Inferno object, which is generally either exposed onto the window or is available via require('inferno') or import Inferno from 'inferno'.
  • createElement: (required) The default export from Inferno’s inferno-create-element package.
  • rootComponent: (required) The top level Inferno component which will be rendered.
  • domElementGetter: (required) A function that takes in no arguments and returns a DOMElement. This dom element is where the Inferno application will be bootstrapped, mounted, and unmounted.