Carousel breaks when API data ingested #444
-
Running into a weird problem with embla-carousel-react. Whenever the carousel depends on data pulled in via the API, it non-deterministically breaks. Specifically, the carousel has the correct number of items (>1), but scrolling doesn't work (neither with buttons, nor by dragging). If the data is hardcoded beforehand this doesn't happen. So it seems something breaks because it goes from 0 items to eg 10. Has anyone run into this before? Any advice? Would hate to move to another package, but this got so annoying we either need to solve it or we dont have a choice. Our versions: "embla-carousel-react": "^7.0.9", |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Hi @ilmoi, From the Embla documentation: useEffect(() => {
if (emblaApi) emblaApi.reInit()
}, [emblaApi, slides]) Best, |
Beta Was this translation helpful? Give feedback.
Hi @ilmoi,
From the Embla documentation:
Best,
David