React Loadable HOC for Centarius
npm install @centarius/react-loadable> React Loadable plugin for centarius.
``diff`
- !! THIS IS JUST A STUB, NOT YET IMPLEMENTED !! -
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
`sh`
$ npm install --save-dev @centarius/react-loadable
OR
`sh`
$ yarn add @centarius/react-loadable
__TL;DR All static methods will be hoisted__
`js`
centariusReactLoadable: (options: ReactLoadableOptions) => ReactLoadableComponent
See this link for more options
`js
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