next-dynamic-loading-props
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

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

Package Sidebar

Install

npm i next-dynamic-loading-props

Weekly Downloads

452

Version

0.1.1

License

MIT

Unpacked Size

9.13 kB

Total Files

13

Last publish

Collaborators

  • kevin940726