Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified

Async Load

<AsyncLoad /> is a React component intended for use in loading modules on-demand. Combined with the transform-wpcalypso-async Babel plugin and Webpack code splitting, it offers an easy mechanism for creating new bundles to be loaded asynchronously.

Usage

Pass with a require string for the module path to be loaded:

<AsyncLoad require="calypso/components/async-load" />;

Depending on the environment configuration, this will be transformed automatically into either a require or require.ensure call.

See babel-plugin-transform-wpcalypso-async documentation for more information.

Props

The following props can be passed to the AsyncLoad component:

property type required comment
require String (Function) yes In general usage, this should be passed as a string of the module to be imported. During build, the string prop is transformed to a function which is called to require the specified module.
placeholder PropTypes.node no A placeholder to be shown while the module is being asynchronously required. If omitted, a default placeholder will be shown. If null is provided, then no placeholder is shown.