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

Warning: Can't perform a React state update on an unmounted component #3

Open
Muhammadinaam opened this issue Mar 13, 2020 · 0 comments

Comments

@Muhammadinaam
Copy link

Very nice plugin.

I am rotating the cube with interval. following is my code:

useEffect(() => {
    let interval;
    if (props.autoRotateInterval)
      interval = setInterval(() => {
        if (carouselRef != null && carouselRef.current != null && isMounted) {
          carouselRef.current.next();
        }
      }, props.autoRotateInterval);

    return () => {
      carouselRef.current = null;
      clearInterval(interval);
    };
  }, []);

I am getting the following warning:

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.
in Motion (created by Carousel)
in div (created by Carousel)


I think Carousel is setting state without checking if it has been mounted or not.

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

No branches or pull requests

1 participant