0

I am trying to learn refluxjs right now but looking at a github project called react-news.

Specifically this line of the project is a bit confusing to me:

https://github.com/echenley/react-news/blob/master/src/js/App.jsx#L80

Actions.hideModal();

Actions comes from import Actions from './actions/Actions'; of the project.

When I look into Actions.js, the only instances of hideModal I see are on lines 41 and 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

I am not sure where the logic for Actions.hideModal(); comes from.

Liondancer
  • 15,721
  • 51
  • 149
  • 255

1 Answers1

1

In Reflux.js (at least in =< 0.2.x), actions are handled in stores. Once you go looking around in the stores, you'll see there's a modalStore which sets up listening to all actions, and triggers a propogation of the modalState.show prop when hideModal is called:

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

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

Brian Vanderbusch
  • 3,313
  • 5
  • 31
  • 43