An extended flux implement for both server/client side.
Check example projects you can see how fluxex do server side rendering + context deliver + Full HTML react rendering!
So far we do not include these in the example, but ....coming soon!
- api call cross server/client
- complex action creator
Fluxex is context based flux implemention. Server side react rendering can be done easy when the flux is scoped under a request based context. Store and dispatcher are singletons in Facebook flux, but in fluxex they are not.
Fluxex
- Fluxex is an instance, it is constructed by provided context.
- Fluxex can be serialized by
.toString()
and reconstructed by the serialized string. All server side store status can be transfered to client side by this way.
Action
- An action creator should return a promise.
- An action creator function can be executed with
.executeAction()
method under a Fluxex instance. - When the action be
.executeAction()
, the Fluxex instance can be referenced bythis
. .executeAction()
will return a promise, so you can manage asynchronous actions in promise way.
Dispatcher
- the Fluxex instance itself is a dispatcher with
.dispatch()
method. - the dispatched
FOOBAR
action will trigger all stores withhandleFOOBAR
method under the Fluxex instance.
Store
- Store is an instance, it is constructed by serialized status.
- Store is created by a Fluxex object automatically.
- Store naming and prototype information are provided by the
.stores
property of Fluxex instance. - Use
.getStore(name)
to get the store by name from an Fluxex instance.
Define your app
Provide store {name: implementation}
pairs and Html.jsx location (example):
'use strict';
var commonStores = require('fluxex/extra/commonStores');
module.exports = require('fluxex').createApp({
page: commonStores.page,
productStore: require('./stores/product')
}, process.cwd() + '/components/Html.jsx');
.... to be continue ...