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

Cannot update a component while rendering a different component. Probably due to bad setState() #707

Open
tramax opened this issue May 11, 2021 · 7 comments

Comments

@tramax
Copy link

tramax commented May 11, 2021

Describe the bug
React issues a warning about bad setState when the Carousel component is used

To Reproduce
Steps to reproduce the behavior:

  1. Install 10.2.0
  2. Install react-carousel 2.0.3
  3. Dynamic import the carousel component like so (as NextJS SSR crashes using normal import)
import dynamic from 'next/dynamic';

const Carousel = dynamic(
  () => import('@brainhubeu/react-carousel'),
  { ssr: false },
);
  1. Use the carousel
  2. See error in Chrome console

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
image

Environment

System:
    OS: Windows 10 10.0.19042
    CPU: (4) x64 Intel(R) Core(TM) i5-7600 CPU @ 3.50GHz  
    Memory: 1.43 GB / 7.94 GB
  Binaries:
    Node: 16.0.0 - C:\Program Files\nodejs\node.EXE       
    npm: 7.10.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 90.0.4430.212
    Edge: Spartan (44.19041.906.0), Chromium (90.0.818.56)
    Internet Explorer: 11.0.19041.1
  npmPackages:
    @brainhubeu/react-carousel: 2.0.3 => 2.0.3
@kb1995
Copy link

kb1995 commented May 17, 2021

@tramax Were you able to fix this error?

@rheng001
Copy link

Facing the same issue

@tramax
Copy link
Author

tramax commented May 23, 2021

@tramax Were you able to fix this error?

@kb1995 unfortunately not yet 😄 do you face the same problem with NextJS or another stack?

@shaunstoltz
Copy link

Same issue... this is a critical bug, make this lib gargbage

@shaunstoltz
Copy link

I got this working by used the source and removing all the scss imports as they were bugging in my build environment. Simple import of the index.js file from the src directory here https://github.com/brainhubeu/react-carousel/tree/master/react-carousel/src and the errors about setState were resolved.

@tramax
Copy link
Author

tramax commented Jun 17, 2021

I got this working by used the source and removing all the scss imports as they were bugging in my build environment. Simple import of the index.js file from the src directory here https://github.com/brainhubeu/react-carousel/tree/master/react-carousel/src and the errors about setState were resolved.

Hi Shaun. Do you use dynamic import via 'next/dynamic'? Would you be able to post a screenshot or a snippet of your code? Thank you

@shaunstoltz
Copy link

Hi, sorry I abandoned this in favor of https://github.com/akiran/react-slick that just seems to work our of the box

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

4 participants