鍍金池/ 問答/HTML/ redux 狀態(tài)實時更新到非路由頁面組件中去?

redux 狀態(tài)實時更新到非路由頁面組件中去?

正常的路由頁面獲取redux:

//container.js

//react-redux redux-thunk等插件
export default withRouter(connect(mapStateToProps, mapDispatchToProps)(couter));

route.js

const AppRouter = () => (
  <HashRouter>
      <UI/>
      {
        routes.map((page, index) => page.component ?
          <Route key={index} exact path={page.path} component={page.component}/> : "")
      }
  </HashRouter>
);

問題:
1、共用的ui組件怎么實時獲取更新的state?通過store.getState() 無法實現(xiàn)實時獲??!

備注:
各頁面通過dispatch(loading)、dispatch(hideloading)、dispatch(alert) 更新ui的state 以實現(xiàn)!

回答
編輯回答
生性

已解決!從vue轉(zhuǎn)過來自己有點繞暈了。

2017年8月20日 22:40