laurenchen0631 / react-owl-carousel

React + Owl Carousel
Apache License 2.0
198 stars 109 forks source link

UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. | Please update the following components: ReactOwlCarousel #111

Open AlirezaGhadyani opened 2 years ago

AlirezaGhadyani commented 2 years ago

im using the 2.3.3v and i have this issue

index.js:1 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.

Please update the following components: ReactOwlCarousel Capture

ThomasSalty commented 2 years ago

I have the exact same error. The app is working fine, Owl Carousel is working fine except for this error message in the console:

react-dom.development.js:67 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: ReactOwlCarousel

@laurenchen0631 This is the same as Issue 110 which was opened on 29 Nov 2021. Should we expect a fix for this in one of the next releases?

td-cristian-torrado commented 2 years ago

Hi Guys here i have the seme issue. Please update the way that you manage the state. Any plan for this update ?

rayhanmujumdar commented 2 years ago

how to fixed this warning anybody can help?

grzegorz-muszynski commented 1 year ago

Hi. I found "UNSAFE_componentWillReceiveProps" only in react-owl-carousel/src/OwlCarousel.tsx. It seems to be used in lines 32-34...

    public UNSAFE_componentWillReceiveProps() {
        this.destory();
    }

...and 80-84:

    public destory() {
        if (!this.$ele) throw new Error('OwlCarousel is not created');

        this.$ele.trigger('destroy.owl.carousel');
    }

Is this necessary? Seems like those lines were useless. Maybe if it will be removed or replaced correctly, an error message will disappear. Can anybody help?

Milind-P commented 1 year ago

Is there a fix to this yet?

Milind-P commented 1 year ago

I am using react-owl-carousel-dotlab. They don't have this issue and there is no need to update the code, just install this package and import it.

ktm72 commented 1 year ago

I am using react-owl-carousel-dotlab. They don't have this issue and there is no need to update the code, just install this package and import it.

Page Not Found....

numaanjaved commented 9 months ago

I am having the same issue right now

sirajulgit commented 2 months ago

I am having the same issue right now