React TypeError:没有'new'就不能调用类构造函数Fullpage [英] React TypeError: Class constructor Fullpage cannot be invoked without 'new'
问题描述
当我使用如下所示的标记时,出现此错误!
<块引用>React TypeError:类构造函数 Fullpage 不能在没有 'new' 的情况下被调用
看起来第 1438 行出了点问题:renderWithHooks
node_modules/react-dom/cjs/react-dom.development.js:14803
这是我的 Fullpage.js
文件:
import React, {Component} from 'react';导入'./Fullpage.css'class Fullpage 扩展 Comment{使成为(){const {children}=this.props返回(<div className={`fullpage ${this.props.className ||''}`}>{孩子们}
);}}导出默认整页
App.js
文件:
import React, { Component } from 'react'从'./data.json'导入数据;从'./logo.svg'导入标志;导入'./App.css';从'react-social-icons' 导入 { SocialIcon };从 './components/Fullpage.js' 导入 Fullpage类 App 扩展组件{使成为(){返回(<div className="应用程序容器"><div className="导航">
<Fullpage className="first"><h1 className="title";id={标题"}>{数据.title}<div><h2>{data.subtitle}
<div className="icons-wrapper">{Object.keys(data.links).map(key=>{返回(<div className="icon"><SocialIcon url={data.links[key]}/>