Cannot read properties of undefined (reading 'values')
See original GitHub issueDescribe the bug
I am using Storybook and React on my project and I am having an error when I tried to see the Docs of my component:
The weird thing is that the component looks great, I only have this issue with Docs.
To Reproduce This is my code. Breadcrumb.tsx:
import { Grid } from "@mui/material";
import { styled } from "@mui/material/styles";
import { B500 } from "../colors/Colors";
import { Item } from "./components/Item";
import { createGenerateClassName, StylesProvider } from "@mui/styles";
export interface IBreadcrumbProps {
/** The icon that appears at the start of the Breadcrumb. */
icon: JSX.Element;
children: any;
/** The extra CSS styles of the component. */
style?: Object;
}
const StyledGrid = styled(Grid)({
"& > svg, & > svg > g > use": {
fill: `#${B500}`,
height: "16px",
width: "16px",
},
});
const breadcrumb = createGenerateClassName({
seed: "breadcrumb",
});
export const Breadcrumb = ({ icon, children, style }: IBreadcrumbProps) => {
return (
<StylesProvider generateClassName={breadcrumb}>
<StyledGrid container alignItems="center" style={style}>
{icon}
{children}
</StyledGrid>
</StylesProvider>
);
};
Breadcrumb.Item = Item;
Breadcrumb.stories.tsx:
import { Breadcrumb } from "./Breadcrumb";
import { AssessmentIcon } from "../icons/Icons";
export default {
title: "Breadcrumb",
component: Breadcrumb,
};
export const Default = (args) => {
return (
<Breadcrumb {...args} icon={<AssessmentIcon />}>
<Breadcrumb.Item
label="Label number one"
onClick={() => console.log("Click on the first label.")}
/>
<Breadcrumb.Item label="Label number two" />
</Breadcrumb>
);
};
Default.argTypes = {
icon: { control: { disable: true } },
};
System I am using npm. My package.json:
"dependencies": {
"@date-io/luxon": "^1.3.13",
"@emotion/react": "^11.7.1",
"@material-ui/pickers": "^3.3.10",
"@mui/icons-material": "^5.3.1",
"@mui/lab": "^5.0.0-alpha.67",
"@mui/material": "^5.4.0",
"@mui/styled-engine-sc": "^5.3.0",
"@mui/styles": "^5.3.0",
"@rollup/plugin-json": "^4.1.0",
"@svgr/webpack": "^6.2.1",
"clsx": "^1.1.1",
"luxon": "^1.28.0",
"prettier": "^2.5.1",
"react-datepicker": "^4.6.0"
},
"devDependencies": {
"@babel/core": "^7.16.12",
"@babel/preset-env": "^7.16.11",
"@babel/preset-react": "^7.16.7",
"@babel/preset-typescript": "^7.16.7",
"@material-ui/core": "^4.12.3",
"@rollup/plugin-commonjs": "^21.0.0",
"@rollup/plugin-node-resolve": "^13.1.3",
"@storybook/addon-actions": "^6.4.18",
"@storybook/addon-essentials": "^6.4.18",
"@storybook/react": "^6.4.18",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@types/jest": "^27.4.0",
"@types/luxon": "^2.0.9",
"babel-jest": "^27.4.6",
"draft-js": "^0.11.7",
"draft-js-custom-styles": "^2.1.1",
"draft-js-export-html": "^1.4.1",
"hex-rgb": "^5.0.0",
"jest": "^27.4.7",
"postcss": "^8.4.6",
"postcss-import": "^14.0.2",
"react": "^17.0.1",
"react-dom": "^17.0.2",
"rollup": "^2.67.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-peer-deps-external": "^2.2.3",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-svg": "^2.0.0",
"rollup-plugin-typescript2": "^0.31.2",
"rollup-plugin-url": "^3.0.1",
"styled-components": "^5.3.3",
"typescript": "4.5.5"
},
"peerDependencies": {
"styled-components": "^5.3.1",
"@types/react": "^17.0.2",
"react": "^17.0.1",
"react-dom": "^17.0.1"
},
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
TypeError: Cannot read property 'value' of Undefined in JS
To solve the "Cannot read property 'value' of undefined" error, make sure that the DOM element you are accessing exists. The error is...
Read more >Uncaught TypeError: Cannot read property of undefined In
JavaScript TypeError is thrown when an operand or argument passed to a function is incompatible with the type expected by that operator or...
Read more >Cannot Read Property of Undefined in JavaScript - Rollbar
Undefined means that a variable has been declared but has not been assigned a value. In JavaScript, properties and functions can only belong...
Read more >Uncaught TypeError: Cannot read property 'value' of undefined
I have some JavaScript code that gives this error. Uncaught TypeError: Cannot read property 'value' of undefined.
Read more >[SOLVED] Cannot Read Property of Undefined in JavaScript
The “cannot read property of undefined” error occurs when you attempt to access a property or method of a variable that is undefined...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Update: this issue is fixed with https://github.com/storybookjs/storybook/releases/tag/v6.5.0-alpha.31! Hope you can release that soon 😄
Bom dia, show de bola, foi atualizar para esta versão e consegui usar o mui.
Muito obrigado !!!