fluxible-resolver

Takes an object of resolvers, keyed by the name of the prop they are resolving, and doesn't render the underlying component until all data is available.


License
ISC
Install
npm install fluxible-resolver@1.2.0

Documentation

fluxible-resolver

Usage

import resolveToStores from 'fluxible-resolver';

const stores = [RecipeStore];
const getStateFromStores = context => ({
  cake: context.getStore(RecipeStore).getCakeRecipe()
});
const resolvers = {
  cake: {
    dependencies: [], // optional
    resolver: context => context.executeAction(fetchCakeRecipe)
  }
};
const inputPropTypes = {
    inputProp: PropTypes.any
};

const Container = resolveToStores(stores, getStateFromStores, resolvers, propTypes /* optional */)(Component);

TODO

  • only pass in input props (defined by propTypes) that are listed as dependencies
  • only call getStateFromStores if dependencies have resolved