“TypeError: Object(...) is not a function";反应-redux-firebase [英] "TypeError: Object(...) is not a function" react-redux-firebase

查看:29
本文介绍了“TypeError: Object(...) is not a function";反应-redux-firebase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 React 中创建一个项目,并且正在使用 Firebase.在我的 react-redux-firebase 项目中,一行代码出错,但我无法修复.我该如何解决这个TypeError: Object(...) is not a function"

我已经搜索过这个问题,但无法解决问题.

我正在学习 React 版本为 16.4.1 的教程.我不确定这是不是问题

index.js 文件

从反应"导入反应;从react-dom"导入 ReactDOM;导入./index.css";从./App"导入应用程序;import * as serviceWorker from "./serviceWorker";import { createStore, applyMiddleware, compose } from redux";从./store/reducers/rootReducer"导入rootReducer;从react-redux"导入{提供者};从redux-thunk"导入 thunk;import { reduxFirestore, getFirestore } from redux-firestore";import { reactReduxFirebase, getFirebase } from react-redux-firebase";从./config/fbConfig"导入 fbConfig;常量存储 = 创建存储(根减速器,撰写(applyMiddleware(thunk.withExtraArgument({ getFirebase, getFirestore })),reduxFirestore(fbConfig),reactReduxFirebase(fbConfig)));

<块引用>

如果我注释掉 reatReduxFirebase() 那么它工作正常,但我需要这个工作

您可以在这里找到所有代码:https://github.com/martuza-shimul/React-Blog-app

我每次都收到此错误:

TypeError: Object(...) is not a function模块../src/index.jsi:/学习新事物/react/pma/src/index.js:1714 |常量存储 = 创建存储(15 |根减速器,16 |撰写(>17 |applyMiddleware(thunk.withExtraArgument({ getFirebase, getFirestore })),18 |reduxFirestore(fbConfig),19 |reactReduxFirebase(fbConfig)20 |

我不知道如何解决这个问题.非常感谢您的帮助/提示.

解决方案

请使用这个 npm 包
npm 包兼容性问题

npm i --save react-redux@5.1.1 react-redux-firebase@2.2.4

I'm trying to create a project in React and I'm using Firebase. In my react-redux-firebase project one line of code making error but I couldn't fix that. How could I fix this "TypeError: Object(...) is not a function"

I have searched for this problem but couldn't fix the problem.

I'm following a tutorial where the react version is 16.4.1. I'm not sure this is the problem or not

index.js file

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 { reduxFirestore, getFirestore } from "redux-firestore";
import { reactReduxFirebase, getFirebase } from "react-redux-firebase";
import fbConfig from "./config/fbConfig";

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

if I comment out the reatReduxFirebase() then it works fine but I need this to work

You could find all codes here: https://github.com/martuza-shimul/React-Blog-app

I'm getting this error every time:

TypeError: Object(...) is not a function
Module../src/index.js
i:/Learning new things/react/pma/src/index.js:17
  14 | const store = createStore(
  15 |   rootReducer,
  16 |   compose(
> 17 |     applyMiddleware(thunk.withExtraArgument({ getFirebase, getFirestore })),
  18 |     reduxFirestore(fbConfig),
  19 |     reactReduxFirebase(fbConfig)
  20 |  

I'm not sure how to fix this. A little bit of help/hint really be appreciated.

解决方案

Please use this npm packages
npm packages compatibility issue

npm i --save react-redux@5.1.1 react-redux-firebase@2.2.4

这篇关于“TypeError: Object(...) is not a function";反应-redux-firebase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆