在App.js上调用redux动作有意义吗?

时间:2018-08-27 04:00:46

标签: react-native redux push-notification react-redux

我的App.js中有一个标准的redux设置,如下所示:

render() {
  const store = createStore(reducers, {}, applyMiddleware(ReduxThunk));
  return (
    <Provider store={store}>
      <MainNavigator />
    </Provider>
  );
}

现在我也在此文件中添加了推送通知侦听器

componentWillMount(){
  OneSignal.init('xx');
  OneSignal.addEventListener('opened', this.onOpened);
}

onOpened(openResult){
  //receiving data
  //thinking to call an action to store the notification into redux
}

想知道在App.js中调用一个动作将收到的通知存储到Redux中有意义吗?

0 个答案:

没有答案