使用 React router v4 在 react-boilerplate 中加载异步 reducer 和 sagas

Load Async reducers and sagas in react-boilerplate with React router v4

我正在考虑将一个项目迁移到最新的 react-boilerplate 版本,许多模块已经更改。我在使用 React router v4 来玩我的 reducer 和 sagas 时遇到了问题。我看了 我现在收到以下错误: 警告:React.createElement:类型无效——需要一个字符串(对于内置组件)或一个 class/function(对于复合组件)但得到:对象。

Check the render method of withReducer(Component). in withReducer(Component) (created by Route) in Route (created by App) in Switch (created by App) in div (created by App) in App (created by Connect(App)) in Connect(App) (created by Route) in Route (created by withRouter(Connect(App))) in withRouter(Connect(App)) in Router (created by BrowserRouter) in BrowserRouter in IntlProvider (created by LanguageProvider) in LanguageProvider (created by Connect(LanguageProvider)) in Connect(LanguageProvider) in Provider

我的代码与我遵循的示例略有不同,因为我添加了 withRouter:

const withConnect = withRouter(connect(mapStateToProps, mapDispatchToProps));

const addHelpReducer = injectReducer({ key: 'help', reducer: helpReducer });

export default compose(
    addHelpReducer,
    withConnect
  )(Help);

injectReducer 来自 react-boilerplate utils 文件,我没有修改那个文件或 configureStore 文件。

我知道怎么做了:

export default compose(
    withRouter,
    withReducer,
    withSaga,
    withConnect
  )(Help);

尽管我现在进入了另一个问题。关闭这个。