gpt4 book ai didi

javascript - 使用 ReactReduxFirebaseProvider 时 firebase 未定义

转载 作者:行者123 更新时间:2023-12-01 01:22:05 26 4
gpt4 key购买 nike

我正在尝试从react-redux v2迁移到v3并开始使用ReactReduxFirebaseProvider。但我不知道为什么我得到:

Line 22:  'firebase' is not defined  no-undef

这是我的代码:

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
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 fbConfig from './config/fbConfig'


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

const rrfProps = {
firebase,
config: fbConfig,
dispatch: store.dispatch,
createFirestoreInstance
}

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

有人能指出我做错的事情的正确方向吗?

最佳答案

将其包含在您的代码中:

import firebase from 'firebase/app'

关于javascript - 使用 ReactReduxFirebaseProvider 时 firebase 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54137788/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com