Giter Site home page Giter Site logo

MuiPickersFadeTransitionGroupRoot: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead. about mui-x HOT 12 CLOSED

mtr1990 avatar mtr1990 commented on September 27, 2024 1
MuiPickersFadeTransitionGroupRoot: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.

from mui-x.

Comments (12)

hongz1 avatar hongz1 commented on September 27, 2024 4

@LukasTy I got two warnings today although "react/require-default-props" is off. any suggestions to hide these warnings?

Warning: MuiPickersFadeTransitionGroupRoot: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead. at eval (webpack-internal:///(ssr)/./node_modules/@emotion/react/dist/emotion-element-6bdfffb2.esm.js:61:74) at PickersFadeTransitionGroup (webpack-internal:///(ssr)/./node_modules/@mui/x-date-pickers/DateCalendar/PickersFadeTransitionGroup.js:45:83) at div at eval (webpack-internal:///(ssr)/./node_modules/@emotion/react/dist/emotion-element-6bdfffb2.esm.js:61:74) at div at eval (webpack-internal:///(ssr)/./node_modules/@emotion/react/dist/emotion-element-6bdfffb2.esm.js:61:74) at PickersCalendarHeader (webpack-internal:///(ssr)/./node_modules/@mui/x-date-pickers/PickersCalendarHeader/PickersCalendarHeader.js:154:97) at div at eval (webpack-internal:///(ssr)/./node_modules/@emotion/react/dist/emotion-element-6bdfffb2.esm.js:61:74) at DateCalendar (webpack-internal:///(ssr)/./node_modules/@mui/x-date-pickers/DateCalendar/DateCalendar.js:165:86)

Warning: MuiPickersSlideTransitionRoot: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead. at eval (webpack-internal:///(ssr)/./node_modules/@emotion/react/dist/emotion-element-6bdfffb2.esm.js:61:74) at PickersSlideTransition (webpack-internal:///(ssr)/./node_modules/@mui/x-date-pickers/DateCalendar/PickersSlideTransition.js:130:83) at eval (webpack-internal:///(ssr)/./node_modules/@emotion/react/dist/emotion-element-6bdfffb2.esm.js:61:74) at div at eval (webpack-internal:///(ssr)/./node_modules/@emotion/react/dist/emotion-element-6bdfffb2.esm.js:61:74) at DayCalendar (webpack-internal:///(ssr)/./node_modules/@mui/x-date-pickers/DateCalendar/DayCalendar.js:258:84) at div at Transition (webpack-internal:///(ssr)/./node_modules/react-transition-group/esm/Transition.js:130:34) at Fade (webpack-internal:///(ssr)/./node_modules/@mui/material/Fade/Fade.js:56:79)

from mui-x.

mernblockchainlover2019 avatar mernblockchainlover2019 commented on September 27, 2024 3

Hi Guys?
I faced same issues with @hongz1.
I used Next.js/Typescript/MUI.
Could you help me?

from mui-x.

oliviertassinari avatar oliviertassinari commented on September 27, 2024 3

As for why the error is reported on MuiPickersFadeTransitionGroupRoot, it's because of https://github.com/emotion-js/emotion/blob/73f688103c5307c90d7544508b6d935243e4299e/packages/styled/src/base.js#L183. We could yolo do:

const PickersSlideTransitionRoot = styled(TransitionGroup, {

+delete PickersSlideTransitionRoot.defaultProps;

to silence the error, but the one on TransitionGroup will stay πŸ˜„. So we truly want reactjs/react-transition-group#898.

I'm recording this in: emotion-js/emotion#3184. It will make sense to kill this line at one point.

from mui-x.

michaldudak avatar michaldudak commented on September 27, 2024 1

Maybe only consider removing this rule:
https://github.com/mui/material-ui/blob/bf891feebee5473be8ee2795878950f186dd75d7/.eslintrc.js#L160
It was added 3 years ago and seems like it should not be turned off nowadays when such a thing is already deprecated. πŸ™ˆ
WDYT @mui/code-infra?

This rule is disabled, so the deprecated defaultProps are not required. If we remove it, we'll get many errors such as propType "theme" is not required, but has no corresponding defaultProps declaration

from mui-x.

RaphyPoo avatar RaphyPoo commented on September 27, 2024 1

This is also happening to me on my nextjs 14.1.4 application, is there a fix or not yet?

from mui-x.

oliviertassinari avatar oliviertassinari commented on September 27, 2024 1

@LukasTy It feels like:

  1. We could have this issue open. The problem is still present.
  2. We could solve this with #11531 (comment) for the time being, leaving a "TODO remove once reactjs/react-transition-group#898 fixed"
  3. We could ask Sebastian access to react-transition-group to carry this one forward for React 19 support.

from mui-x.

LukasTy avatar LukasTy commented on September 27, 2024

Thank you for reporting this problem. πŸ‘
It seems to be coming from https://github.com/reactjs/react-transition-group/blob/2989b5b87b4b4d1001f21c8efa503049ffb4fe8d/src/TransitionGroup.js#L169 and the fact that we are wrapping this component with styled.
The root cause still seems to be inside of the react-transition-group.
I'm not sure if we can do anything about it as it is... 🀷
Maybe only consider removing this rule:
https://github.com/mui/material-ui/blob/bf891feebee5473be8ee2795878950f186dd75d7/.eslintrc.js#L160
It was added 3 years ago and seems like it should not be turned off nowadays when such a thing is already deprecated. πŸ™ˆ
WDYT @mui/code-infra?

P.S. The same error is also thrown if a TransitionGroup component is wrapped in a styled call on the application side. Tested with the provided example locally.

I will create an issue in the react-transition-group repository to handle the removal of defaultProps.

from mui-x.

LukasTy avatar LukasTy commented on September 27, 2024

@mtr1990 We've decided to not do anything in this regard.
The react-transition-group package is a direct dependency of the pickers package, whenever they will support the new approach for defining the defaultProps - we will inherit it by bumping the dependency version.
In the meantime, consider disabling the rule, just as we did: https://github.com/mui/material-ui/blob/bf891feebee5473be8ee2795878950f186dd75d7/.eslintrc.js#L160 because it's clear that this transition is not that important to the React team if they didn't go through with updating packages that they maintain. πŸ˜‰

from mui-x.

LukasTy avatar LukasTy commented on September 27, 2024

@hongz1 Would you be able to provide a minimal reproduction example so that we could test this behavior? πŸ€”
A GitHub repo would be as helpful as a live example. πŸ‘

from mui-x.

hongz1 avatar hongz1 commented on September 27, 2024

test-app.zip

@LukasTy Here you go. I made new nextjs app with minimal dependencies. You will see those warning messages when you go to /test page.

from mui-x.

palucdev avatar palucdev commented on September 27, 2024

Is there any way to hide the warning or disable it for simple DateCalendar component usage? "react/require-default-props": "off" doesn't work for me.

from mui-x.

LukasTy avatar LukasTy commented on September 27, 2024

Is there any way to hide the warning or disable it for simple DateCalendar component usage? "react/require-default-props": "off" doesn't work for me.

You are probably referring to an ESLint rule?
The error is thrown by React runtime, which does not work together with your ESLint config in any way. πŸ™ˆ

I'm sorry, but there does not seem to be any quick way to fix the issue.
It has to be fixed upstream or we have to replace react-transition-group (if React no longer maintains it and can't keep it in sync with React itself). πŸ™ˆ

As for the time beingβ€”feel free to experiment with this suggestion: recharts/recharts#3615 (comment) πŸ˜‰

from mui-x.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.