import React , { FC , Suspense } from 'react' ; import { EuiDelayRender , EuiErrorBoundary , EuiLoadingContent } from '@elastic/eui' ; const Fallback = ( ) => ( < EuiDelayRender > < EuiLoadingContent lines = { 3 } / > < /EuiDelayRender>); interface Props < T > { getLazyComponent : ( ) => FC < T > ; lazyComponentProps : T ; } export function LazyWrapper < T > ( { getLazyComponent , lazyComponentProps } ) { const LazyComponent = getLazyComponent ( ) ; return ( < EuiErrorBoundary > < Suspense fallback = { < Fallback / > } > < LazyComponent { ... lazyComponentProps } / > < /Suspense> < /EuiErrorBoundary>); }