Warning: Failed prop type: The following props are not supported: `className`. Please remove them.
See original GitHub issueDuplicates
- I have searched the existing issues
Latest version
- I have tested the latest version
Current behavior 😯
This is my code:
import { Grid } from "@mui/material";
import { styled } from "@mui/material/styles";
import { IBreadcrumbProps } from "./Breadcrumb.types";
import { B500 } from "../colors/Colors";
import { Item } from "./components/Item";
import { createGenerateClassName, StylesProvider } from "@mui/styles";
const PREFIX = "Breadcrumb";
const classes = {
breadcrumb: `${PREFIX}-breadcrumb`,
};
const StyledStylesProvider = styled(StylesProvider)({
[`& .${classes.breadcrumb}`]: {
background: "red",
"& > svg, & > svg > g > use": {
fill: `#${B500}`,
height: "16px",
width: "16px",
},
},
});
const breadcrumb = createGenerateClassName({
seed: "breadcrumb",
});
export const Breadcrumb = ({ icon, children, style }: IBreadcrumbProps) => {
return (
<StyledStylesProvider generateClassName={breadcrumb}>
<Grid
container
alignItems="center"
className={classes.breadcrumb}
style={style}
>
{icon}
{children}
</Grid>
</StyledStylesProvider>
);
};
Warning:
Is className
deprecated? I saw an example of this here: https://mui.com/guides/migration-v4/#migrate-from-jss
What should I use to replace it? Because also with this approach my styles are not being applied:
Expected behavior 🤔
Styles work as expected and no warnings should be present
Steps to reproduce 🕹
No response
Context 🔦
I am migrating from v4 to v5 following Material Official Guide.
Your environment 🌎
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Using MuiThemeProvider throws "Failed prop type ... - GitHub
js:1446 Warning: Failed prop type: The following properties are not supported: className . Please remove them. This error does not show if I...
Read more >Failed prop type: The prop `children` is not supported. Please ...
it looks like you are trying to use prop name as 'children' whichi impossible because it is used as the inner components of...
Read more >Breaking changes in v5, part two: core components - Material UI
This is a reference guide to all of the breaking changes introduced in Material v5, and how to handle them when migrating from...
Read more >CHANGELOG.old.md - mui/material-ui - Sourcegraph
Support vertical tabs (#16628) @josephpung. You can learn more about it following this URL. Remove the prop-types from TypeScript demos (# ...
Read more >How to Use PropTypes in React - freeCodeCamp
import React from 'react'; import { PropTypes } from "prop-types"; const Count = (props) => { return ( <> ......... </> ) };...
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 FreeTop 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
Top GitHub Comments
Aah ok, I see thanks for pointing this out. @siriwatknp up to you. I don’t think it’s critical, but maybe worth considering
I understand the solution, thanks for giving me the information. This issue appears when I ran
npx @mui/codemod v5.0.0/jss-to-styled .\src\Breadcrumb\
This command is the one that stylesStylesProvider
. Maybe it will be great if you make some changes to the command to NOT style the context provider.Anyway, for me, the issue is fixed. I will close this. Thanks for helping me @mnajdova