Influx.js
ES6 React 0.14 Component, Dispatcher, Store communication
npm install react-influx
Dispatcher.js
const Events = ; Dispatcher // override as needed
App.jsx
Component { ; const count = Store; thisstate = count; } { return Dispatcher DispatcherEventsALERT '_onAlert' Store StoreEventsUPDATED this_onIncrement } { ; } { // Store.getCount() === count this; } { return <div> <h5>Component ▶ Dispatcher ▶ Store ▶ Component</h5> <div>thisstatecount</div> <button =>Dispatch INCREMENT</button> <br /> <h5>Component ▶ Dispatcher ▶ Component</h5> <div>thisstatemessage</div> <button =>Dispatch ALERT</button> </div> }
Store.js
const Events = ; Store { ; thisdata = count: 0; thisclassName = thisconstructorname; } { return thisdatacount; } { return Dispatcher DispatcherEventsINCREMENT '_onDispatcherIncrement' Dispatcher DispatcherEventsALERT this_onDispatcherAlert } { thisdatacount++; this; } { console; } { switch event case DispatcherEventsINCREMENT: case DispatcherEventsALERT: default: console; }