moxystudio / react-carousel

A React carousel component that aims to be as flexible as possible
MIT License
14 stars 3 forks source link

Access changing slides during renders #9

Open satazor opened 4 years ago

satazor commented 4 years ago

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 and currentIndex, previous and previousIndex.

Access how react-carousel deals with changes to slides and implement the necessary changes.