gpt4 book ai didi

javascript - 无法读取未定义的属性 'createElement'

转载 作者:行者123 更新时间:2023-11-29 18:39:26 24 4
gpt4 key购买 nike

我的 React 应用程序出现了一些问题。我正在实现功能 authUser,现在我收到如下错误:

TypeError: Cannot read property 'createElement' of undefined

返回时显示红色(..

这是我的代码

import { React, Component } from "react";
import Widget from "components/Widget/index";
import { Badge, Button, Col, Row } from "antd";
import { Link } from "react-router-dom";
import { connect } from "react-redux";
import { userSignOut } from "appRedux/actions/Auth";
import LineIndicator from "./LineIndicator";


class Portfolio extends Component {

render() {
const { authUser } = this.props;

return (
<Widget>
<h2 className="h4 gx-mb-3">Your Portfolio Balance</h2>
<Row>
<Col lg={12} md={12} sm={12} xs={24}>

<div className="ant-row-flex">
<h2 className="gx-mr-2 gx-mb-0 gx-fs-xxxl gx-font-weight-medium">$179,626</h2>
</div>
<p className="gx-text-grey"></p>
<div className="ant-row-flex gx-mb-3 gx-mb-md-2">
<Button className="gx-mr-2" type="primary">Deposit</Button>
<Button className="gx-btn-cyan">Withdraw</Button>
</div>
<p><Link className="gx-text-primary" to="/te">- Messages <Badge count={23} style={{ backgroundColor: '#52c41a' }} /></Link></p>
<p><Link className="gx-text-primary" to="/te">- Notifications <Badge count={320} style={{ backgroundColor: '#52c41a' }} /></Link></p>
<p><Link className="gx-text-primary" to="/te">- Active Servers <Badge count={5} style={{ backgroundColor: '#52c41a' }} /></Link></p>
<p><Link className="gx-text-primary" to="/te">- Billing </Link></p>
<p><Link className="gx-text-primary" to="/te">- Logout </Link></p>


</Col>
<Col lg={12} md={12} sm={12} xs={24}>
<div className="gx-site-dash">
<h4 className="gx-mb-3">Welcome back {authUser ? authUser.name : "Loading"}</h4>
<img alt="" width="160" src={require("assets/images/w-logo.png")} />
</div>
</Col>
</Row>
</Widget>
)
}
}

const mapStateToProps = ({ auth }) => {
const { authUser } = auth;
return { authUser }
};

export default connect(mapStateToProps, { userSignOut })(Portfolio);

我做错了什么?

最佳答案

我认为你没有正确导入 React

import { React, Component } from "react";

应该是这样

import React, {Component} from "react";

关于javascript - 无法读取未定义的属性 'createElement',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58331766/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com