question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warning: Failed prop type: The following props are not supported: `className`. Please remove them.

See original GitHub issue

Duplicates

  • 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: image

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: image

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:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
mnajdovacommented, Dec 1, 2021

This command is the one that styles StylesProvider. Maybe it will be great if you make some changes to the command to NOT style the context provider.

Aah ok, I see thanks for pointing this out. @siriwatknp up to you. I don’t think it’s critical, but maybe worth considering

1reaction
BiancaArtolacommented, Dec 1, 2021

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 styles StylesProvider. 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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found