Skip to content

crubier/react-loadable-context

Repository files navigation

react-loadable-context

Website at https://crubier.github.io/react-loadable-context/

A component to asynchronously load any object into the react context, for example when using Code Splitting.

npm install --save react-loadable-context

Just like the new context API, this function returns:

  • A Provider, which injects the loaded object into the context as soon as the promise is resolved
  • Various Consumer components, which gracefully handle loading and error states.

This is particularly usefull when creating libraries which interface react with third party heavy libraries, such as Cesium, vis.js, openlayers and others. The main "wrapper" component for the library uses the Provider. The various "elements" of the library use the Consumer.

Losely inspired by react-loadable and the new context API.

About

Asynchronously load object into the context

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published