将Redux SubApp与React Router配合使用

问题描述 投票:1回答:1

是否有可能使用这种方法isolating SubApps与React路由器?

问题是每次路由更改时,SubApp将重新呈现,然后redux存储将断开连接。

class BigApp extends Component {
  render() {
    return (
      <Router history={history} >
        <Route component={SubApp1} />
        <Route component={SubApp2} />
        <Route component={SubApp3} />
      </Router>
    )
  }
}
reactjs redux react-router
1个回答
0
投票

是。我有同样的问题。我解决它的方式是here。解决方案的关键是在每个子应用程序的根应用程序和本地存储上维护一个全局存储,并在它们之间使用Observer模式。

© www.soinside.com 2019 - 2024. All rights reserved.