oliviertassinari / react-swipeable-views

A React component for swipeable views. :snowflake:
https://react-swipeable-views.com/
MIT License
4.46k stars 480 forks source link

fixed UNSAFE_componentWillReceiveProps error #662

Closed hkimani closed 2 years ago

hkimani commented 2 years ago

Replaced ‘UNSAFE_componentWillReceiveProps’ with ‘static getDerivedStateFromProps’

Address the following error:

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

Might also be related to: #534

korbav commented 2 years ago

Hi @hkimani, a PR already exists https://github.com/oliviertassinari/react-swipeable-views/pull/654 We are all waiting for it to be eventually merged.

hkimani commented 2 years ago

Hi @hkimani, a PR already exists #654 We are all waiting for it to be eventually merged.

Okay, noted with thanks. This one can be closed then

hkimani commented 2 years ago

Handled in #654

NawarA commented 2 years ago

Is this merged and released? I still see the issue appearing in React 18x

hkimani commented 2 years ago

Is this merged and released? I still see the issue appearing in React 18x

@NawarA. There is a pull request, #654 addressing the same issue, you could check it out.

NawarA commented 2 years ago

@hkimani I looks like the PR passes all tests, but for some reason its not yet merged with master.

Given it passes all tests and fixes the React 18 / React 17 bug, then can you please merge, update the semantic patch version, and release to npm?

Thank you 🙏