single-spa-inferno

1.0.1 • Public • Published

single-spa-inferno

Generic lifecycle hooks for Inferno applications that are registered as child applications of single-spa.

Quickstart

First, in the child application, run npm install --save single-spa-inferno (or jspm install npm:single-spa-inferno if your child application is managed by jspm). Then, in your child app's entry file, do the following:

import Inferno from 'inferno';
import rootComponent from './path-to-root-component.js';
import singleSpaInferno from 'single-spa-inferno';
 
const infernoLifecycles = singleSpaInferno({
  Inferno,
  createElement,
  rootComponent,
  domElementGetter: () => document.getElementById('main-content'),
});
 
export const bootstrap = [
  infernoLifecycles.bootstrap,
];
 
export const mount = [
  infernoLifecycles.mount,
];
 
export const unmount = [
  infernoLifecycles.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.

/single-spa-inferno/

    Package Sidebar

    Install

    npm i single-spa-inferno

    Weekly Downloads

    4

    Version

    1.0.1

    License

    MIT

    Last publish

    Collaborators

    • joeldenning
    • kentmclean