Skip to content

Latest commit

 

History

History
71 lines (54 loc) · 1.31 KB

SwidgetLoader.md

File metadata and controls

71 lines (54 loc) · 1.31 KB

API: <SwidgetLoader>

<SwidgetLoader />

Central component to load Swidgets from external sources.

Every app that consumes Swidgets, should be built as "host" with npm run build:host

Properties:

interface ISwidgetLoaderProps {
    name: string;
    errorFallback?: (error: Error) => React.ReactNode;
    loadingPlaceholder?: React.ReactNode;
    url: string;
    props?: object;
    uniqueId?: string;
}

name

name:string

Name of the Swidget. Must match the name of the application that is loaded with the JS.


errorFallback

errorFallback?: (error: Error) => React.ReactNode

Fallback Component, that is rendered, if the Swidget can't be loaded. Error message passed als parameter.


loadingPlaceholder

loadingPlaceholder?: React.ReactNode

Loader component, can override the default loader.


url

url: string

URL of the Swidget-JS.


props

props?: object

Properties, that are passed into the Swidget.


uniqueId

uniqueId?: string

Unique ID of the Swidget. Should be set, if more Swidgets with same name are loaded. This property is used to map the swidget-routes into the routing-hash and should not be random (reload should always result in same ID for a swidget in a certain position).