YIZHUANG / react-multi-carousel

A lightweight production-ready Carousel that rocks supports multiple items and server-side rendering with no dependency. Bundle size 2kb.
MIT License
1.25k stars 286 forks source link

Can't perform a React state update on an unmounted component #329

Open CiotkaCierpienia opened 2 years ago

CiotkaCierpienia commented 2 years ago

Describe the bug An error occurs when unmounting the component that contains the Carousel: react_devtools_backend.js:3973 Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method. I saw that this was already fixed in 2.5.0, but is back for 2.8.0.

To Reproduce Steps to reproduce the behavior:

  1. Go to the page with carousel
  2. Change the slide
  3. Go back to the page without carousel

Expected behavior Component unmounts without error

Screenshots image

Additional context Carousel component:

<Carousel
     draggable={false}
     infinite
     autoplay={false}
     responsive={responsive}
     arrows={false}
     customButtonGroup={<CarouselNavigation />}
     className="mx-auto mt-8 re"
     renderButtonGroupOutside
>

"react": "17.0.2", "react-multi-carousel": "^2.8.0",