react-hot-component-loader
v1.0.3
Published
Async component for React-Hot-Loader
Downloads
19
Maintainers
Readme
Simple, but usable Async Component loader to be used with React-Hot-Loader.
The only one WORKING loader, specially designed for RHL workflow.
#Usage
import hotLoader from 'react-hot-component-loader';
const Component = hotLoader( () => import('./Component'));
That is all. Component will be loaded and displayed. And not state will be lost on Hot Module Replacement.
#Advanced Usage
import hotLoader from 'react-hot-component-loader';
const Component = hotLoader(
() => import('./Component'),
{
LoadingComponent: // the one to be shown upon loading
ErrorComponent: // the one to be shown in case of error
exportPicker: (value) => value.default // in case you need not default export
}
);
#Component API Not HoC, but Component approach. Very usable for React-Hot-Loader, as long does not creates new or hidden components.
import { HotComponentLoader } from 'react-hot-component-loader';
const Component = (props) => (
<HotComponentLoader
loader = {() => import('./Component')}
...
/>
);
Read more about it on medium
#Licence MIT