React Loadable plugin for centarius.
Centarius React Loadable is just like Centarius State-HOC.
Its own purposes are to reduce boilerplate in your render function AND pass LoadingComponent
and ErrorComponent
respectively to React Loadable instances.
What does it mean?
It means that we can use same LoadingComponent
and Error Component
for both fetching initial data / props or loading split files
$ npm install --save-dev @centarius/react-loadable
OR
$ yarn add @centarius/react-loadable
TL;DR All static methods will be hoisted
centariusReactLoadable: (options: ReactLoadableOptions) => ReactLoadableComponent
See this link for more options
import centariusReactLoadable from '@centarius/react-loadable';
import LoadingComponent from './Loading';
import ErrorComponent from './Error';
export default centariusReactLoadable({
loader: () => import('./index'),
...rest,
// both this options will be passed onto loading properties in ReactLoadable
// it means loading will be overriden by these two
LoadingComponent,
ErrorComponent,
});
Any issues or questions can be sent to the centarius monorepo.
Please be sure to specify that you are using @centarius/react-loadable
.
MIT © Ray Andrew