@loadable/component

loadable

Create a loadable component.

ArgumentsDescription
loadFnThe function call to load the component.
optionsOptional options.
options.fallbackFallback displayed during the loading.
options.ssrIf false, it will not be processed server-side. Default to true.
import loadable from '@loadable/component'
const OtherComponent = loadable(() => import('./OtherComponent'))

lazy

Create a loadable component "Suspense" ready.

ArgumentsDescription
loadFnThe function call to load the component.
import { lazy } from '@loadable/component'
const OtherComponent = lazy(() => import('./OtherComponent'))

LoadableComponent

A component created using loadable or lazy.

PropsDescription
fallbackFallback displayed during the loading.
...Props are forwarded as first argument of loadFn

LoadableComponent.preload

Force the loading of a component.

ArgumentsDescription
argsProps passed to the load function.
import loadable from '@loadable/component'
const OtherComponent = loadable(() => import('./OtherComponent'))
OtherComponent.preload()

loadable.lib

Create a loadable library.

ArgumentsDescription
loadFnThe function call to load the component.
optionsOptional options.
options.fallbackFallback displayed during the loading.
import loadable from '@loadable/component'
const Moment = loadable.lib(() => import('moment'))

lazy.lib

Create a loadable library "Suspense" ready.

ArgumentsDescription
loadFnThe function call to load the component.
import { lazy } from '@loadable/component'
const Moment = lazy.lib(() => import('moment'))

LoadableLibrary

A component created using loadable.lib or lazy.lib.

PropsDescription
childrenFunction called when the library is loaded.
refAccepts a ref, populated when the library is loaded.
fallbackFallback displayed during the loading.
...Props are forwarded as first argument of loadFn