Options
All
  • Public
  • Public/Protected
  • All
Menu

Module app

Entrypoint for SDK that should be used within application bundle. It works well with server and client side rendering.

Client side

At client side your app receives instance of the IlcAppSdk via props that are passed to it's lifecycle functions (LifeCycles). So everything is pretty simple here :) Typings can be loaded in the following way:

example
import IlcAppSdk from 'ilc-sdk/app';

Server side

Unfortunately during app's SSR we don't have ILC in place. So we need to use result of the IlcSdk.processRequest (which implements AppSdkAdapter) to receive all the necessary data for IlcAppSdk initialization.

example
const IlcSdk = require('ilc-sdk').default;
const IlcAppSdk = require('ilc-sdk/app').default;

const ReactDOMServer = require('react-dom/server');
const {default: App} = require('./build/server');

server.get('*', (req, res) => {
    const ilcReqData = ilcSdk.processRequest(req);
    const appSdk = new IlcAppSdk(ilcReqData);

    const html = ReactDOMServer.renderToString(App(appSdk));

    res.send(html);
});

Index

Type aliases

ErrorHandler

ErrorHandler: (error: Error, errorInfo?: Record<string, any>) => void

Allows to handle uncaught app/parcel errors. For apps it will be passed by ILC and handled centrally. For parcels it may be passed by Parcel component and handled there.

Type declaration

    • (error: Error, errorInfo?: Record<string, any>): void
    • Parameters

      • error: Error
      • Optional errorInfo: Record<string, any>

      Returns void

MountParcel

MountParcel: <ExtraProps>(parcelConfig: ParcelConfig<ExtraProps>, customProps: ParcelMountProps & ExtraProps) => ParcelObject<ExtraProps>

Type declaration

ParcelConfig

ParcelConfig<ExtraProps>: LifeCycles<ParcelLifecycleFnProps<ExtraProps>> | (() => Promise<LifeCycles<ParcelLifecycleFnProps<ExtraProps>>>)

Type parameters

  • ExtraProps

ParcelLifecycleFnProps

ParcelLifecycleFnProps<ExtraProps, RegProps>: ExtraProps & ParcelMountProps & ParcelLifecycleFnPropsSystem<RegProps>

Describes all properties that are passed by ILC & single-spa to the application lifecycle Fns

Type parameters

  • ExtraProps

  • RegProps

Render404

Render404: (withCustomContent?: boolean) => void

Type declaration

    • (withCustomContent?: boolean): void
    • Parameters

      • Optional withCustomContent: boolean

      Returns void

Functions

Const isSpecialUrl

  • isSpecialUrl(url: string): boolean

Generated using TypeDoc