facebookarchive / flux

Application Architecture for Building User Interfaces
https://facebookarchive.github.io/flux/
Other
17.47k stars 3.46k forks source link

Example using Store instead of ReduceStore #448

Closed spacedarcy closed 6 years ago

spacedarcy commented 6 years ago

Hi, just wondering why there aren't any examples using the plain Store class, or an explanation of the differences between it and ReduceStore.

kyldvs commented 6 years ago

That is because we strongly recommend using ReduceStore instead of the plain Store. The Store class can be thought of as utilities to help implement ReduceStore. Store provides functionality like connecting to a dispatcher, adding listeners, and emitting changes.

The only example I would recommend for using Store is the implementation of ReduceStore itself: https://github.com/facebook/flux/blob/master/src/stores/FluxReduceStore.js