我现在正在尝试学习refluxjs,但是正在看一个叫做react-news的github项目。
具体来说,这个项目的这一行让我有点困惑:
https://github.com/echenley/react-news/blob/master/src/js/App.jsx#L80
Actions.hideModal();
Actions来自项目的import Actions from './actions/Actions';。
当我查看Actions.js时,我只在第41和50行看到了hideModal的实例。
https://github.com/echenley/react-news/blob/master/src/js/actions/Actions.js#L41 https://github.com/echenley/react-news/blob/master/src/js/actions/Actions.js#L50
我不确定Actions.hideModal();的逻辑从何而来。
发布于 2015-07-28 06:43:29
在Reflux.js中(至少在=< 0.2.x中),操作是在存储中处理的。当您在商店中四处寻找时,您会看到有一个modalStore,它设置侦听所有操作,并在调用hideModal时触发modalState.show属性的传播:
hideModal() {
modalState.show = false;
this.trigger(modalState);
}https://github.com/echenley/react-news/blob/master/src/js/stores/ModalStore.js
https://stackoverflow.com/questions/31664490
复制相似问题