rollup-plugin-react-lazy
Dynamic imports (powered by React Suspense) for components and hooks.
Get Started
- Add the plugin to your Rollup config:
// In the "plugins" arrayreactLazy
- Create the resolver module:
// React hook that returns the directory name to be imported from.
- Import from either provider in your components:
- Render
<Suspense>
providers around the dynamic elements:
- All done! Now your app will dynamically load the modules it needs based on
the return value of your
useModuleProvider
hook.