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

Support React 16.3 StrictMode #10793

Closed
1 task done
htc001120 opened this issue Mar 24, 2018 · 9 comments
Closed
1 task done

Support React 16.3 StrictMode #10793

htc001120 opened this issue Mar 24, 2018 · 9 comments
Assignees
Labels
core Infrastructure work going on behind the scenes

Comments

@htc001120
Copy link

htc001120 commented Mar 24, 2018

There is new lifecycle and StrictMode since React 16.3
with StrictMode enabled, there will be some warning message

Warning: Unsafe lifecycle methods were found within a strict-mode tree:
in App (created by WithStyles(App))
in WithStyles(App) (at index.js:7)

componentWillReceiveProps: Please update the following components to use static getDerivedStateFromProps instead: ButtonBase, Drawer, TransitionGroup, WithStyles(AppBar), WithStyles(ButtonBase), WithStyles(Divider), WithStyles(Drawer), WithStyles(GridWrapper), WithStyles(Header), WithStyles(HiddenCss), WithStyles(IconButton), WithStyles(List), WithStyles(ListItem), WithStyles(ListItemText), WithStyles(Paper), WithStyles(SvgIcon), WithStyles(Toolbar), WithStyles(TouchRipple), WithStyles(Typography)

Learn more about this warning here:
https://fb.me/react-strict-mode-warnings

  • I have searched the issues of this repository and believe that this is not a duplicate.

Steps to Reproduce (for bugs)

https://codesandbox.io/s/342pq38xxp
Here is an example when I use Typography component with StrictMode
opt out and the error message is in the console

Your Environment

Tech Version
Material-UI 1.0.0-beta.38
React 16.3
browser chrome 65
@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 24, 2018

I have done the first iteration two weeks ago. I should be able to complete it in the near future. Help is always welcome.

@dcworldwide
Copy link

Will this break backwards compatibility with react <16.3?

@oliviertassinari
Copy link
Member

oliviertassinari commented Mar 24, 2018

Will this break backwards compatibility with react <16.3?

No, as we are using react-lifecycles-compat.

@avdd
Copy link

avdd commented Sep 7, 2018

I'm still getting warnings from Input and Transition

@eps1lon
Copy link
Member

eps1lon commented Sep 7, 2018

Well https://github.com/mui-org/material-ui/blob/f9b58109da9e66f6758ab5c46a8477c6069b3e80/packages/material-ui/package.json#L33
says we do not support react < 16.3.0

@oliviertassinari Is support for react < 16.3 still a goal?

@oliviertassinari
Copy link
Member

We don't support React < 16.3 to leverage the new context API. I doubt the warnings are coming from Material-UI.

@avdd
Copy link

avdd commented Sep 7, 2018

@oliviertassinari I think the UNSAFE_* methods on Input are generating the warnings.
Also react-transition-group has apparently been updated to the new API in 2.4, but mui is pegged to 2.2.

@oliviertassinari
Copy link
Member

mui is pegged to 2.2

@avdd No, we don't:
https://github.com/mui-org/material-ui/blob/09823b5a21fa76d6ab13a1042b5229dde672e28c/packages/material-ui/package.json#L61

I think the UNSAFE_* methods on Input are generating the warnings

Do you have a reproduction?

@oliviertassinari
Copy link
Member

I think the UNSAFE_* methods on Input are generating the warnings

Ok, I can confirm.

@oliviertassinari oliviertassinari added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Dec 20, 2022
@zannager zannager added core Infrastructure work going on behind the scenes and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

No branches or pull requests

6 participants