Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Demo AppBar - Cannot read property 'root' of undefined #16168

Closed
2 tasks done
MMrj9 opened this issue Jun 11, 2019 · 4 comments
Closed
2 tasks done

Demo AppBar - Cannot read property 'root' of undefined #16168

MMrj9 opened this issue Jun 11, 2019 · 4 comments
Labels
package: material-ui Specific to @mui/material

Comments

@MMrj9
Copy link

MMrj9 commented Jun 11, 2019

I'm trying to run the demo code for the AppBar and I'm having the following error:

TypeError: Cannot read property 'root' of undefined
at AppBar (http://localhost:3000/main.6134e384acec73e762d9.hot-update.js:536:50)
at renderWithHooks (http://localhost:3000/main.js:19537:22)
at updateForwardRef (http://localhost:3000/main.js:21101:24)
at beginWork (http://localhost:3000/main.js:22377:20)
at performUnitOfWork (http://localhost:3000/main.js:26372:16)
at workLoop (http://localhost:3000/main.js:26413:28)
at renderRoot (http://localhost:3000/main.js:26493:11)
at performWorkOnRoot (http://localhost:3000/main.js:27450:11)
at performWork (http://localhost:3000/main.js:27360:11)
at performSyncWork (http://localhost:3000/main.js:27334:7)

AppBar Code

import React from 'react';
import { makeStyles } from '@material-ui/core/styles';
import AppBar from '@material-ui/core/AppBar';
import Toolbar from '@material-ui/core/Toolbar';
import Typography from '@material-ui/core/Typography';
import Button from '@material-ui/core/Button';
import IconButton from '@material-ui/core/IconButton';
import MenuIcon from '@material-ui/icons/Menu';

const useStyles = makeStyles(theme => ({
  root: {
    flexGrow: 1,
  },
  menuButton: {
    marginRight: theme.spacing(2),
  },
  title: {
    flexGrow: 1,
  },
}));

export default function ButtonAppBar() {
  const classes = useStyles();

  return (
    <div className={classes.root}>
      <AppBar position="static">
        <Toolbar>
          <IconButton edge="start" className={classes.menuButton} color="inherit" aria-label="Menu">
            <MenuIcon />
          </IconButton>
          <Typography variant="h6" className={classes.title}>
            News
          </Typography>
          <Button color="inherit">Login</Button>
        </Toolbar>
      </AppBar>
    </div>
  );
}
  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Your Environment 🌎

Tech Version
Material-UI v4.1.0
React v16.8.2
OS Mac OS
@joshwooding joshwooding added status: waiting for author Issue with insufficient information and removed status: waiting for author Issue with insufficient information labels Jun 11, 2019
@joshwooding
Copy link
Member

Please can you provide a minimal reproducible example? A codesandbox or a stand-alone got repository will do.

@sps-software
Copy link

@joshwooding
Copy link
Member

@sps-software Weird the problem disappears when you remove antd from the package.json

@joshwooding joshwooding reopened this Apr 13, 2020
@joshwooding joshwooding added package: material-ui Specific to @mui/material and removed status: waiting for author Issue with insufficient information labels Apr 14, 2020
@joshwooding
Copy link
Member

@sps-software the problem disappears if you use 4.1.3 of antd.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: material-ui Specific to @mui/material
Projects
None yet
Development

No branches or pull requests

3 participants