简体   繁体   中英

Flux, ReactJS, what are the store part of the architecture

I m actually studying ReactJS and the Flux architecture but I dont really understand what is exactly the "Store" part in this.

What it is exactly ? A database ? A localstorage file ?

Thanks for advance

The store is the part of the application which is responsiple for business logic. An app of any size will have multiple, possibly interdependent, stores. When a store responds to a user action, it may persist data to a database (probably via some restful endpoint), run a calculation or any other business logic. After a store is done, it should emits an event to which views can respond.

the stores themselves contain this business logic. Each store is responsible for a domain of the application, and only update themselves in response to actions.

http://fluxxor.com/what-is-flux.html

With flux you organize your data changes. You call actions from your views which will be dispatched to the stores. Then data manipulation is done in the stores and the change event will be emitted.

For easier and better implementation of a "lean" flux concept look at reflux. It is way easier to grasp.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM