0

我现在正在尝试学习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,我看到的唯一实例hideModal是在第 41 行和第 50 行。

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

我不确定 for 的逻辑Actions.hideModal();从何而来。

4

1 回答 1

1

在 Reflux.js 中(至少在 =< 0.2.x 中),操作在商店中处理。一旦你在商店里四处寻找,你会看到有一个modalStore设置监听所有动作,并在被调用modalState.show时触发道具的传播:hideModal

hideModal() {
    modalState.show = false;
    this.trigger(modalState);
}

https://github.com/echenley/react-news/blob/master/src/js/stores/ModalStore.js

于 2015-07-27T22:43:28.530 回答