https://github.com/kevin940726/next-dynamic-loading-props
Pass props to the loading components in next/dynamic
https://github.com/kevin940726/next-dynamic-loading-props
dynamic lazy loadable next nextjs react
Last synced: 10 months ago
JSON representation
Pass props to the loading components in next/dynamic
- Host: GitHub
- URL: https://github.com/kevin940726/next-dynamic-loading-props
- Owner: kevin940726
- License: mit
- Created: 2021-02-28T05:55:31.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-03-02T08:44:46.000Z (over 5 years ago)
- Last Synced: 2024-04-14T05:47:57.186Z (about 2 years ago)
- Topics: dynamic, lazy, loadable, next, nextjs, react
- Language: TypeScript
- Homepage: http://npm.im/next-dynamic-loading-props
- Size: 319 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# next-dynamic-loading-props
Pass props to the loading components in next/dynamic. A package to workaround [vercel/next.js#7906](https://github.com/vercel/next.js/issues/7906).
## Installation
```sh
npm install next-dynamic-loading-props
```
## Usage
```jsx
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
}
}
));
```