import { AsyncComponentProps } from "./types.js"; import { ReactElement } from "react"; //#region src/AsyncComponent/AsyncComponent.d.ts /** * A React component that asynchronously loads and renders another component based on the provided `component` prop. * It also handles asynchronous dependencies before loading the component. * * @param props - The properties for the `AsyncComponent`. * @param props.component - A function returning a promise that resolves to the component to be loaded. * @param props.dependencies - An optional array of dependencies that need to be resolved before the component is loaded. * @param props.fallback - An optional fallback React element or component to display while the main component is loading. * @param restProps - Any additional props to pass to the loaded component. * * @returns A React element that either displays the fallback, the loaded component, or `null` if neither is available. * * @remarks * - The `component` prop should be a function that returns a promise resolving to a React component. * - The `dependencies` prop should be an array of dependencies, which will be resolved before loading the main component. * - The `fallback` prop will be shown while waiting for the main component and dependencies to load. * - Once all dependencies are resolved, the `component` will be loaded and rendered with any additional `restProps`. * - If the `component` or dependencies fail to load, errors will be logged to the console. * * @example * // Example usage: * import('./MyComponent')} * dependencies={[import('./dependency1'), import('./dependency2')]} * fallback={} * someProp={value} * /> * // The `AsyncComponent` will render `LoadingSpinner` until all dependencies are resolved * // and the component is loaded, then it will render the loaded component with `someProp`. */ declare function AsyncComponent(props: AsyncComponentProps): ReactElement> | null; //#endregion export { AsyncComponent }; //# sourceMappingURL=AsyncComponent.d.ts.map