reactjs flux - Should view call the store directly? -



reactjs flux - Should view call the store directly? -

from flux's todomvc example, saw todoapp component asking store states.

should view create action , allow dispatcher phone call store instead?

the views listening stores' "change" event called controller-views, because have 1 controller-like aspect: whenever stores change, info stores , pass children through props.

the controller-views views should calling stores' getters. getters should public api stores expose. stores have no setters.

it's tempting phone call stores' getters within render() method of component deep in tree, anti-pattern. violates unidirectional info flow, making more hard understand flow of info through application, , , makes rendering more expensive.

in todomvc flux example, todoapp component controller-view.

reactjs-flux flux

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -