reactjs - TypeError:- 类扩展值未定义不是构造函数或 null
问题描述
我刚刚开始学习 React。当我通过 node.js 运行服务器时,我在 localhost:3000 中收到此错误
TypeError: Class extends value undefined is not a constructor or null
索引.js
import React , {Compnonent} from "react";
class lottery extends Compnonent {
render() {
return (
<h1>Decentralized Lottery Application</h1>
)
}
}
export default lottery;
解决方案
有一个错字 {Component} 修复它。
您将其拼写为 {Compnonent}
import React , {Component} from "react";
推荐阅读
- webpack - Webpack 不加载图片?
- python - discord.py 同时使用 on_message() 和 command()
- c++ - 有没有办法防止单词在 C++ 输出中被“剪切”?
- tensorflow - 我无法导入 tensorflow 的 cpu 版本
- javascript - 多头时如何制作表格的粘性表头
- javascript - 如何将 google sheet 中的单元格值设置为 HTML 侧边栏的 textarea 的默认值?
- javascript - 无法使用 websocket 将 Javascript 客户端连接到 PHP 服务器
- apache-spark - 如何在 zeppelin 中使用网络可视化图形?
- python - if-else 块有什么问题?
- python - 在 Python shell 工作中获取当前工作角色 - Aws Glue