Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot read property 'createElement' of undefined

I'm having some problems with my React app. I was implementing feature authUser and now I'm receiving error like:

TypeError: Cannot read property 'createElement' of undefined

and it shows red on return (..

This is my code

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);

What am I doing wrong?

like image 487
rade rade Avatar asked Nov 01 '25 15:11

rade rade


1 Answers

I think you are importing React incorrectly

import { React, Component } from "react";

Should be this

import React, {Component} from "react";
like image 83
ppak10 Avatar answered Nov 04 '25 05:11

ppak10



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!