TypeError:Object(...)不是函数,Redux?

时间:2020-06-28 19:09:18

标签: reactjs firebase redux react-redux

在我的React,Redux,Firebase项目中,我遇到一个奇怪的错误TypeError: Object(...) is not a function

这是index.js文件:

import React from 'react';
import ReactDOM from 'react-dom';
import { Provider } from 'react-redux';
import { getFirebase, reactReduxFirebase } from 'react-redux-firebase';
import { applyMiddleware, compose, createStore } from 'redux';
import { getFirestore, reduxFirestore } from 'redux-firestore';
import thunk from 'redux-thunk';
import App from './App';
import rootReducer from './components/reducers/rootReducer';
import fbConfig from './config/fbConfig';

const store = createStore(rootReducer,
  compose(
    applyMiddleware(thunk.withExtraArgument({getFirebase, getFirestore})),
    reduxFirestore(fbConfig),
    reactReduxFirebase(fbConfig)
  )
)

ReactDOM.render(
  <React.StrictMode>
    <Provider store={store}>
      <App />
    </Provider>
  </React.StrictMode>,
  document.getElementById('root')
);

我得到那个错误:

×
TypeError: Object(...) is not a function
Module../src/index.js

  15 | 
  16 | const store = createStore(rootReducer,
  17 |   compose(
> 18 |     applyMiddleware(thunk.withExtraArgument({getFirebase, getFirestore})),
  19 |     reduxFirestore(fbConfig),
  20 |     reactReduxFirebase(fbConfig)
  21 |   )

该代码中的问题在哪里,为什么我会收到该错误?

0 个答案:

没有答案