Greetings !
I'm building a slider that is destined to be modified in terms of items quantity.
I made a fairly simple setup for this slider to work and, without re-rendering, it works as expected.
The problem comes when adding/deleting items in this slider, the snapping stops working, although I am re-building the whole logic on length change, and of course, after reverting the context on react's useEffect's `return`
A pile of code will be more obvious to show what is tried to be achieved, so find my codepen hereby.
Reproduction:
- Slide the slider to see snapping work and fit to "current slide"
- Click top left button to add an item
- See re-rendering happen
- Slide again in the slider
- Snapping doesnt work.
I ran out of ideas of how I could possibly fix this, or work around it.
Any help is welcome ! Thanks