Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

next-dynamic-loading-props

kevin94072618.2kMIT0.1.1TypeScript support: included

Pass props to the loading components in next/dynamic

next, next-dynamic, loadable

readme

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} />