0

I am looking at migrating a project to the latest react-boilerplate version and many modules have changed. I am having trouble with React router v4 to play with my reducers and sagas. I looked at Dynamically load redux reducers with react router 4 and I am getting the following error now: Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.

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

My code is slightly different to the example I followed because I am adding withRouter:

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

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

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

injectReducer comes from the react-boilerplate utils file, I have not modified that file or the configureStore file.

webmedia
  • 303
  • 1
  • 3
  • 8

1 Answers1

0

I figured out how to do this:

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

Although I now moved into a different issue. Closing this one.

webmedia
  • 303
  • 1
  • 3
  • 8