首页 > 解决方案 > 我不能在我的 react-typescript 项目中使用 javascript 导入

问题描述

我正在尝试使用 firebase 添加谷歌登录功能。我正在使用反应钩子和打字稿。我似乎无法使用该StyledFirebaseAuth模块。当我尝试渲染它时,它给出了这个错误

JSX element type 'StyledFirebaseAuth' is not a constructor function for JSX elements.
  Type 'StyledFirebaseAuth' is missing the following properties from type 'ElementClass': render, context, setState, forceUpdate, and 3 more.

我已尝试检查我的 tsconfig 是否有任何可能导致此问题的设置

这是我的进口

import StyledFirebaseAuth from 'react-firebaseui/StyledFirebaseAuth';

当我尝试渲染时

<StyledFirebaseAuth
 uiConfig={uiConfig}
 firebaseAuth={firebase.auth()}
 />

我得到这个错误

JSX element type 'StyledFirebaseAuth' is not a constructor function for JSX elements.
  Type 'StyledFirebaseAuth' is missing the following properties from type 'ElementClass': render, context, setState, forceUpdate, and 3 more.

标签: reactjstypescriptfirebase

解决方案


我想通了谢谢。我所要做的就是删除我的 package-lock.json


推荐阅读