1.0.3 • Published 7 years ago

react-hot-component-loader v1.0.3

Weekly downloads
8
License
MIT
Repository
github
Last release
7 years ago

Simple, but usable Async Component loader to be used with React-Hot-Loader.

The only one WORKING loader, specially designed for RHL workflow.

NPM

#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