import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import * as serviceWorker from "./serviceWorker";
import { createStore, applyMiddleware, compose } from "redux";
import rootReducer from "./store/reducers/rootReducer";
import { Provider } from "react-redux";
import thunk from "redux-thunk";
import { createFirestoreInstance, getFirestore } from "redux-firestore";
import { ReactReduxFirebaseProvider, getFirebase } from "react-redux-firebase";
import fsConfig from "./config/fsConfig";
import { firebase } from "firebase/app";
const store = createStore(
rootReducer,
compose(
applyMiddleware(thunk.withExtraArgument({ getFirebase, getFirestore }))
//reduxFirestore(fsConfig),
//reactReduxFirebase(fsConfig)
)
);
const rrfProps = {
firebase,
config: fsConfig,
dispatch: store.dispatch,
createFirestoreInstance
};
//error position=>
ReactDOM.render(
<Provider store={store}>
<ReactReduxFirebaseProvider {...rrfProps}>
<App />
</ReactReduxFirebaseProvider>
</Provider>,
document.getElementById("root")
);
serviceWorker.unregister();
元素类型无效:预期为字符串(对于内置组件)或类/函数(对于复合组件),但得到:未定义。您可能忘记了从定义文件中导出组件,或者可能混淆了默认导入和命名导入。
答案 0 :(得分:0)
这对我有用。打开终端,转到项目的根目录,然后使用以下命令更新react-redux-firebase
:
npm install react-router-redux@next
在ReactReduxFirebaseProvider
的2.4版本中未实现react-redux-firebase
的原因因此导致将其包裹在<App />
组件周围的问题。
您想要获得react-redux-firebase
的3.0版本。