单页面应用中,我能否按照不同的路由加载不同的store?
因为系统复杂(比如三十个页面),应该不可能把所有的状态都何在一个store吧?
希望懂得朋友给点建议,谢谢!
PHPz2017-04-17 13:59:45
Because the system is complex (for example, thirty pages), it shouldn’t be possible to store all the states in one store, right?
I think that in redux’s thinking, it is recommended to use one store for each app. Unless some states are completely independent, there will be no connection. Of course, multiple providers can be used, but this can also be regarded as multiple apps. Redux uses reducer tree to divide the structure, and use selector in each container to select the required store. Don’t worry too much about performance issues. react-redux’s connect will also help you optimize most unnecessary rendering, which is generally fine.
ringa_lee2017-04-17 13:59:45
I don’t think so, but redux limits one and can only have one store.
The entire application state is stored in an object tree, and this object tree only exists in one store.