reactjs - 组件未在反应中定义
问题描述
所以我正在尝试使用 react 构建登录页面,在我的代码中我得到了未定义的错误组件。
const http = new HttpService();
class App extends Componenet {
constructor(props) {
super(props);
http.getProducts();
}
}
不知道我做错了什么,因为我是新来的反应会喜欢一些帮助
解决方案
你是Component
从 react 导入的吗?
如果不是 - 像这样导入
import React, {Component} from 'react';
class App extends Component{}
或者直接这样使用
class App extends React.Component{}
注意-您导入的是 Componenet 而不是 Component,只需更改为 Component。
推荐阅读
- c# - 在 ASP.Net 中获取客户端 IP 总是在代理后面返回本地 IP
- vector - 为什么可以添加Bert的三个embeddings?
- c++ - Unity iOS 应用构建失败:Firebase 插件错误
- ionic-framework - 离子框架=>反应基础项目
- python - 当前路径 Envs/python-projects/learnpy/static/styles/bootstrap4/bootstrap.min.css 与其中任何一个都不匹配
- python - 在 pyodbc 准备好的语句中列出参数
- python - 如何舍入 pandas Float64Index?
- python - 按行计算稀疏矩阵中的 max() 值(数据帧)
- ios - 是否可以自定义 iOS Visionkit VNDocumentCameraViewController
- react-native - 安装 react-native-splash-screen 后 react-native android 应用程序崩溃