Updating state onChanged causes tons of logs
See original GitHub issueI have a problem while trying to set the current active slide index on carousel changed onChanged
. I’m passing this state down the slide, but when I update the slider state it simply reaches the maximum call stack of JS.
I have the following structure:
<Carousel>
<Slide currentSlideIndex={this.state.currentSlideIndex}/>
<Slide currentSlideIndex={this.state.currentSlideIndex}/>
</Carousel>
The thing is that the carousel if going to be controlled by each Slide, since there is some video I want to play, therefore I am planning to use the next()
method.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Updating state onChanged causes tons of logs #21 - GitHub
I have a problem while trying to set the current active slide index on carousel changed onChanged. I'm passing this state down the...
Read more >setState doesn't update the state immediately - Stack Overflow
It means you can't call it on one line and assume the state has changed on the next. According to React docs. setState()...
Read more >Why React doesn't update state immediately - LogRocket Blog
When developing React applications, you may have noticed that state updates don't immediately reflect new values after being changed.
Read more >Common Mistake with Synchronizing State in React -- newline
If some state is updating half way through a render, it may cause unexpected and difficult to debug changes to some other area/state....
Read more >What Every React Developer Should Know About State
If we were to log our newly updated state as we type into our form, ... our state is updated, and this causes...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I create separate component and add shouldComponentUpdate
I made something very similar to @joshuadiezmo
that works like a charm