Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CardHeader is not rendering in React

I'm playing with React and material-ui, other stuff have worked but for some reason <CardHeader> is not getting rendered. Below is the code

import React from "react";
import Card from "@material-ui/core/Card";
import CardHeader from "@material-ui/core/Card";
import CardContent from "@material-ui/core/Card";
import CardActions from "@material-ui/core/Card";
import Button from "@material-ui/core/Button";
import Paper from "@material-ui/core/Paper";
import Typography from "material-ui/Typography";

class PaperCard extends React.Component {
  render() {
    return (
      <Card>
        <CardHeader title="CaHellord" subheader="Test ME" />
        <CardContent>
          <Typography type="title">Word of the day</Typography>
          <Typography type="headline" component="h2">
            impediments
          </Typography>
          <Typography component="p">adjective</Typography>
        </CardContent>
        <CardActions>
          <Button dense> Learn More </Button>
        </CardActions>
      </Card>
    );
  }
}

export default PaperCard;

Could someone point out the obvious which I have missed.

like image 571
DDStackoverflow Avatar asked Jul 22 '26 08:07

DDStackoverflow


1 Answers

It's just the case of incorrect import.

Replace the import of CardHeader from

import CardHeader from "@material-ui/core/Card";

to

import CardHeader from "@material-ui/core/CardHeader";
like image 78
Madhu Bhat Avatar answered Jul 25 '26 00:07

Madhu Bhat



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!