Ideally, react-carousel should be reactive and deal with changes to slides:
Whenever a new slide is added, to the start, end or middle.
Whenever a new slide is removed, from the start, end or middle.
The current implementation uses indices to identify the current slide, which will be out-of-sync when the slides change. Ideally, the current slide should be kept as current, regardless of its index. If the current slide is removed, then the previous should be set as the current instead.
One way to do this is to identify slides by their key. Please note that we may still have the notion of indices, like: current and currentIndex, previous and previousIndex.
Access how react-carousel deals with changes to slides and implement the necessary changes.
Ideally,
react-carousel
should be reactive and deal with changes to slides:The current implementation uses indices to identify the current slide, which will be out-of-sync when the slides change. Ideally, the current slide should be kept as current, regardless of its index. If the current slide is removed, then the previous should be set as the current instead.
One way to do this is to identify slides by their
key
. Please note that we may still have the notion of indices, like:current
andcurrentIndex
,previous
andpreviousIndex
.Access how
react-carousel
deals with changes to slides and implement the necessary changes.