generator-rxreact-module
Version:
Yeoman generator for javascript modules on top of Rx.js and React.js libraries
23 lines (15 loc) • 543 B
text/coffeescript
Rx = require 'rx'
getViewState = (store) ->
clicksCount: store.getClicksCount()
dispatchActions = (view, subject, store) ->
incrementClickCountAction = subject
.filter(({action}) -> action is "increment_click_count")
.do(-> store.incrementClicksCount())
Rx.Observable.merge(
incrementClickCountAction
# some more actions here for updating view ...
).subscribe(
-> view.setProps getViewState(store)
(err) ->
console.error? err)
module.exports = dispatchActions