AppContainerUtils

Overview

AppContainerUtils provides static methods that provides an alternative option to access the AppContainer's fucntionality (with extra functionality of locating AppContainer). It's recommended that you use the APIs provided by ComponentManager, useComponentManager or AppContainer directly rather APIs here.

AppContainerUtils.createAppContainer

You can use AppContainerUtils.createAppContainer to create an AppContainer:

import { AppContainerUtils } from "fractal-component";
const appContainer = AppContainerUtils.createAppContainer({
    ...containerConfigOptions
});

Information of the containerConfigOptions can be found from the document for AppContainer

Please note:

AppContainerUtils.createAppContainer will only create an instance of AppContainer on the first call. Subsequent calls will always return the previous created AppContainer instance.

AppContainerUtils.getAppContainer

The method's type declaration is shown as below:

export declare function getAppContainer(
    componentInstance?: ManageableComponent
): AppContainer;

Here ManageableComponent is a React Class Component.

AppContainerUtils.getAppContainer method accepts one optional componentInstance parameter and will try to locate an AppContainer instane in the following way:

All other AppContainerUtils method will use this method to locate an AppContainer instance if they need one.

ComponentManager use this function for locating AppContainer instance during the initialisation as well.

AppContainerUtils.updateAppContainerRetrieveKey

AppContainerUtils.getAppContainer() by default will use key appContainer to look for an AppContainer instance from the React Component Props.

You can, however, use this method to change the key to be used to look for a appContainer instance.

The method's type declaration is shown as below:

export declare function updateAppContainerRetrieveKey(newKey: string): string;

results matching ""

    No results matching ""