Getting “Cannot call a class as a function” in my React Project

后端 未结 30 946
無奈伤痛
無奈伤痛 2020-12-07 16:34

I\'m trying to add a React map component to my project but run into an error. I\'m using Fullstack React\'s blog post as a reference. I tracked down where the error gets thr

30条回答
  •  攒了一身酷
    2020-12-07 16:49

    For me it was a wrong import of a reducer in the rootReducer.js. I imported container instead of reducer file.

    Example

    import settings from './pages/Settings';
    

    But sure it should be

    import settings from './pages/Settings/reducer';
    

    Where settings directory contains following files actions.js, index.js, reducer.js.

    To check it you can log reducers arg of the assertReducerShape() function from the redux/es/redux.js.

提交回复
热议问题