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

UNSAFE_componentWillReceiveProps lifecycle method now throws a warning in newer versions of React #3919

Closed
lkj19zpdiDDe opened this issue Mar 27, 2020 · 8 comments · Fixed by #3986

Comments

@lkj19zpdiDDe
Copy link

The visibility component is using UNSAFE_componentWillReceiveProps . This now gives a warning.

https://github.com/Semantic-Org/Semantic-UI-React/blob/master/src/behaviors/Visibility/Visibility.js#L191

@welcome
Copy link

welcome bot commented Mar 27, 2020

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you've completed all the fields in the issue template so we can best help.

We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@Talkwondo
Copy link

this is a bug

@keponk
Copy link

keponk commented May 28, 2020

Similar issue using a Tab component. In a clean environment with an empty (or not) <Tab /> we get:

Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://fb.me/react-unsafe-component-lifecycles for details.

* Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state

Please update the following components: Menu, Tab

@brianespinosa
Copy link
Member

brianespinosa commented Jun 1, 2020

@levithomason @layershifter now that React has changed these UNSAFE_* lifecycle methods to show as warnings in newer versions of React, I think it would probably be good for us to go in and update these. componentDidUpdate or possibly getDerivedStateFromProps I believe are the recommended method to reach for in these scenarios. I did not see anything in progress or noted stating that we want to work on this... but I may have missed it. Thoughts?

@brianespinosa brianespinosa changed the title UNSAFE_componentWillReceiveProps in Visibility Component UNSAFE_componentWillReceiveProps lifecycle method now throws a warning in newer versions of React Jun 1, 2020
@brianespinosa
Copy link
Member

@brianespinosa
Copy link
Member

FYI: #3956

@layershifter
Copy link
Member

Was fixed in semantic-ui-react@1.0.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants