0.1.1 • Published 3 years ago

next-dynamic-loading-props v0.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

next-dynamic-loading-props

Pass props to the loading components in next/dynamic

Installation

npm install next-dynamic-loading-props

Usage

import dynamic from 'next/dynamic';
import withLoadingProps from 'next-dynamic-loading-props';

const Modal = withLoadingProps(useLoadingProps => dynamic(
  () => import('./modal'),
  {
    ssr: false,
    loading: () => {
      const props = useLoadingProps();
      return <Loading {...props} />
    }
  }
));

<Modal {...loadingProps} />