I would like to make the child of GridList of react material-ui as component, However the child component does not get the style of maerial-ui. How can I make the React component inherit the GridList's style? my code as following:

const GridContain=(props)=>{
        return {tileData.map(tile => (
          <GridListTile key={tile.img}>
            <img src={tile.img} alt={tile.title} />
            <GridListTileBar
              title={tile.title}
              subtitle={<span>by: {tile.author}</span>}
              actionIcon={
                <IconButton className={classes.icon}>
                  <InfoIcon />
                </IconButton>
              }
            />
          </GridListTile>
        ))}

function TitlebarGridList(props) {
  const { classes } = props;

  return (
    <div className={classes.root}>
      <GridList cellHeight={180} className={classes.gridList}>
        <GridListTile key="Subheader" cols={2} style={{ height: 'auto' }}>
          <ListSubheader component="div">December</ListSubheader>
        </GridListTile>
        <GridContaint> //<<=== instead of the img, GridListTile, etc
      </GridList>
    </div>
  );
}

export default (TitlebarGridList);

0 Answers