Wraps a React component with lazy loading and suspense, displaying a loader while the component is being loaded.

  • Type Parameters

    • T extends ComponentType<P>

      The type of the wrapped React component.

    • P extends object = any

      The props type of the wrapped React component.

    Parameters

    • factory: () => Promise<{ default: T }>

      A function that returns a promise that resolves to the component.

    • Optionaloptions: Partial<IParams>

      Optional parameters for customizing the loader.

    Returns (props: P) => Element

    A function that returns the wrapped component with suspense and loader.