简体   繁体   English

TypeError: Object(...) 不是 function(匿名函数)

[英]TypeError: Object(...) is not a function (anonymous function)

having a problem initializing the Firestore.初始化 Firestore 时遇到问题。 Here is the code:这是代码:

In store.js在 store.js

    import { combineReducers, compose, createStore } from 'redux';
import firebase from 'firebase';
import 'firebase/firestore';
import { reactReduxFirebase, firebaseReducer } from 'react-redux-firebase';
import { reduxFirestore, firestoreReducer } from 'redux-firestore';

//Reducers

const firebaseConfig = {};

// react-redux-firebase config
  const rrfConfig = {
  userProfile: 'users',
  useFirestoreForProfile: true,
};

//init firebase instance
firebase.initializeApp(firebaseConfig);
//init firestore
const firestore = firebase.firestore();

//adding reactReduxFirebase enhencer
firebase.firestore(); // <- needed if using firestore

const rootReducer = combineReducers({
  firebase: firebaseReducer,
  firestore: firestoreReducer,
});

//create initial state
const initialState = {};
    const store = createStore(
  rootReducer,
  initialState,
  compose(
    reactReduxFirebase(firebase),
    window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
  )
);
    export default store;

In App.js在 App.js 中

import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';
import { Provider } from 'react-redux';
import store from './store';
function App() {
  return (
    <Provider store={store}>
      <Router>
        <div className="App">
          <AppNavbar></AppNavbar>
          <Switch>
            <Route exact path="/" component={Dashboard} />
          </Switch>
        </div>
      </Router>
    </Provider>
  );
}

export default App;

Here is the error log |这是错误日志 | //create initial state 40 | //创建初始值 state 40 | 41 | 41 | const initialState = {}; const 初始状态 = {};

42 | 42 | const store = createStore( 43 | rootReducer, 44 | initialState, 45 | compose(reactReduxFirebase(firebase)) const store = createStore( 43 | rootReducer, 44 | initialState, 45 | compose(reactReduxFirebase(firebase))

Any help is appreciated.任何帮助表示赞赏。

The problem is specifically with calling reactReduxFirebase as it is not a function.问题特别在于调用reactReduxFirebase ,因为它不是 function。

I'm not too familiar with the 'react-redux-firebase' package, but it appears that this function was removed from the latest version.我不太熟悉 'react-redux-firebase' package,但似乎这个 function 已从最新版本中删除。

Instead of applying this enhancer to your store, it is now recommended that you wrap your app in a ReactReduxFirebaseProvider .现在建议您将应用程序包装在ReactReduxFirebaseProvider中,而不是将此增强器应用于您的商店。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase function error: Cannot convert undefined or null to object at Function.keys (<anonymous> )</anonymous> - Firebase function error: Cannot convert undefined or null to object at Function.keys (<anonymous>) Pyspark: TypeError: 'Column' object 不可调用 --- 使用 Window Function - Pyspark: TypeError: 'Column' object is not callable --- Using Window Function 类型错误:doc 不是 addSubCollectionDocument 中的 function - TypeError: doc is not a function at addSubCollectionDocument 类型错误:firebase.initializeApp 不是 function - TypeError: firebase.initializeApp is not a function “TypeError: Cannot convert undefined or null to object at Function.entries”使用云功能时出错 - "TypeError: Cannot convert undefined or null to object at Function.entries" Error when using Cloud Functions 类型错误:messaging.getToken 不是 function - TypeError: messaging.getToken is not a function 类型错误:firestoreService.initializeApp 不是 function - TypeError: firestoreService.initializeApp is not a function 类型错误:performanceMeasurement.startMeasurement 不是 function - TypeError: performanceMeasurement.startMeasurement is not a function 未捕获的类型错误:postList.map 不是 function - Uncaught TypeError: postList.map is not a function TypeError: auth is not a function 登录或注册后 - TypeError: auth is not a function after logging in or signing up
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM