react-swipeable-views icon indicating copy to clipboard operation
react-swipeable-views copied to clipboard

Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code

Open AshrinJose opened this issue 3 years ago • 9 comments

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

Expected Behavior

React warning for UNSAFE_componentWillReceiveProps should be gone.

Current Behavior

Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/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://reactjs.org/link/derived-state

Please update the following components: AutoPlay, ReactSwipableView

Steps to Reproduce (for bugs)

  1. update react version to latest code
  2. download the latest react-swipeable-views and react-swipeable-views-utils
  3. write code to show a swipeable images/...
  4. check the development console

Context

Got React Error in development console about breaking code

Your Environment

| react-swipeable-views | ^0.14.0 | | React | ^17.0.2 |

AshrinJose avatar Jan 13 '22 07:01 AshrinJose

Hi @AshrinJose , I filed a PR targeting this precise issue, but unfortunately the repo hasn't been active for the last few months.

https://github.com/oliviertassinari/react-swipeable-views/pull/654

korbav avatar Jan 13 '22 07:01 korbav

Correct, it don't have time to allocate to this repo. It had served this purpose for me in the past, I haven't really spent time on it since the incorporation on MUI Inc. I assume there are better solutions in the React community for solving this problem now, no?

oliviertassinari avatar Jan 14 '22 12:01 oliviertassinari

Hi @oliviertassinari, I imagine you must be quite busy with the awesome MUI library! Concerning this repo, I guess that, according to the 240K downloads a week, it's still being widely used by the community. When you say better solutions to solve this problem, do you mean similar components ? if so, then it might be judicious to tag the repo as deprecated or at least no longer maintained.

korbav avatar Jan 14 '22 12:01 korbav

Correct, it don't have time to allocate to this repo. It had served this purpose for me in the past, I haven't really spent time on it since the incorporation on MUI Inc. I assume there are better solutions in the React community for solving this problem now, no?

According to their docs, MUI is using this library for their swipe able views, am I right? If so, they may want to allocate some resources to this library or even include it as part of mui/lab

danielo515 avatar Jan 23 '22 10:01 danielo515

@oliviertassinari, we would love a merge on the pull request to resolve this issue

This repo is a great addition to MUI and is used by many

npm downloads

SebHex avatar Feb 06 '22 20:02 SebHex

Commenting to emphasize this - some projects have this project as a dependency and now have this error too.

millermeares avatar Feb 27 '22 19:02 millermeares

It's frustrating that mui uses this library and we all still have this issue. Kindly asking for a fix.

alecsandru66 avatar Jun 02 '22 08:06 alecsandru66

Please either fix this or inform the MUI project that this will not be fixed so that project can take appropriate action.

markedwards avatar Jun 24 '22 10:06 markedwards

Just commenting here for others, found from the comment above that shares a PR with the fix that haven't been merged yet but this fixed it for me: https://github.com/oliviertassinari/react-swipeable-views/pull/654#issuecomment-985789605

tdrdimov-dvlpr avatar Mar 01 '23 10:03 tdrdimov-dvlpr