fluxible-plugin-context-config
Fluxible plugin that adds a config to component, store and action contexts.
Usage
Create your app and register the config plugin initialised with a config object:
;;; const app = ; const config = greet: 'hello world' secret: apiKey: '123' ; app;
On the client add the plugin but do not pass in a config like the server. Client state will be automatically rehydrated.
app;
Access the config object on the action, store or component contexts:
const context = app; // action contextcontextconfiggreet;contextconifgsecretapiKey; // server only // store contextcontextconfiggreet;contextconifgsecretapiKey; // server only // component contextcontextconfiggreet;contextconifgsecretapiKey; // server only
For component context, register the config object by providing the context type to the root application component. See http://fluxible.io/api/plugins.html#componentcontext
Secret
Keep config passwords and keys in secret. The dehydrate method will delete config.secret
before returning. This keeps secrets out of the browser.
Quality
- to contribute, fork, branch and submit pull requests for review
- use Node version specified in
.nvmrc
- use ES6
npm test
and maintain 100% coveragenpm run lint
and maintain 0 errors (uses AirBnB JavaScript Style Guide)