fluxette-react
Official React bindings for fluxette.
Install
npm install --save fluxette-react
Bindings
Context A higher order React component that provides a Flux object on the context to all of its children.
;;; React;
connect([selectors])
Extends a Component to manage listeners to the Flux object on this.context
, and performs a setState
when the state changes. It also takes an optional selector or array of selectors, which make the state more specific. It will only calculate a new value if one of the selectors returns a new value. It makes this.context.flux.dispatch
available as this.dispatch
on the component.
;; @Component { this; } { let details = thisstate; return <div> <input ref='nickname' defaultValue= detailsnickname /> <input ref='email' defaultValue= detailsemail /> <button onClick= ::thissubmit >Submit</button> </div> ; }
select(getters, deriver)
Creates a selector that caches the results of the getters
array, which are applied to deriver
as an argument list. It only returns a new value when the getters have returned new data, which is useful for data computations that would break equality checks otherwise.
; let itemsWith = stateproductsonSale stateproductswarranted stateproductshighRated; let productSelector = ; @Component // ... // can also be CheapQualityProducts