fbredius/storybook

View on GitHub
lib/components/src/tooltip/lazy-WithTooltip.tsx

Summary

Maintainability
A
2 hrs
Test Coverage
import React, { ComponentProps, lazy, Suspense } from 'react';

const LazyWithTooltip = lazy(() =>
  import('./WithTooltip').then((mod) => ({ default: mod.WithTooltip }))
);

export const WithTooltip = (props: ComponentProps<typeof LazyWithTooltip>) => (
  <Suspense fallback={<div />}>
    <LazyWithTooltip {...props} />
  </Suspense>
);

const LazyWithTooltipPure = lazy(() =>
  import('./WithTooltip').then((mod) => ({ default: mod.WithTooltipPure }))
);

export const WithTooltipPure = (props: ComponentProps<typeof LazyWithTooltipPure>) => (
  <Suspense fallback={<div />}>
    <LazyWithTooltipPure {...props} />
  </Suspense>
);