@centarius/react-loadable
React Loadable plugin for centarius.
- !! THIS IS JUST A STUB, NOT YET IMPLEMENTED !! -
- !! THIS IS JUST A STUB, NOT YET IMPLEMENTED !! -
Introduction
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
Install
$ npm install --save-dev @centarius/react-loadable
OR
$ yarn add @centarius/react-loadable
API (CAN BE CHANGED IN THE FUTURE)
TL;DR All static methods will be hoisted
centariusReactLoadable: (options: ReactLoadableOptions) => ReactLoadableComponent
See this link for more options
Usage
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,
});
Support
Any issues or questions can be sent to the centarius monorepo.
Please be sure to specify that you are using @centarius/react-loadable
.
License
MIT © Ray Andrew