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

Using Android Volley to post an array to PHP -

python - How to add an model instance to a django queryset? -

angularjs - No 'Access-Control-Allow-Origin' error from local domain to public API -