0.1.0 • Published 10 years ago
fluxible-plugin-config v0.1.0
Config Plugin for Fluxible
Your config available from your component, action & store contexts.
Features
- Shares config from server to client (you can use environment variable)
- Works well with browserify / webpack
- Comes with a "do whatever you want" (MIT) license
Install
Add the package to your project :
npm install --save fluxible-plugin-config
Register it to your fluxible instance :
import configPlugin from 'fluxible-plugin-config';
app.plug(configPlugin({
foo: process.env.FOO,
bar: process.env.BAR,
}));
Component Context
export default class MyComponent extends React.Component {
static contextTypes = {
config: React.PropTypes.object
}
render() {
return (
<p>foo: {this.context.config.foo}, bar: {this.context.config.bar}</p>
);
}
}
Action Context
export default function doStuff(context, params) {
debug('foo:', context.config.foo);
}
Store Context
class MyStore extends BaseStore {
getFoo() {
return this.getContext().config.foo;
}
}
0.1.0
10 years ago