Skip to content

Observing image change in autoplay slideshow carousel #197

Answered by igordanchenko
hus-o asked this question in Q&A
Discussion options

You must be logged in to vote

You can use the on.view callback to keep track of the slide index.

const [index, setIndex] = React.useState(0);

// ...

<Lightbox
  index={index}
  on={{ view: ({ index: currentIndex }) => setIndex(currentIndex) }}
  // ...
/>

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@hus-o
Comment options

@thaiduongnguyen17
Comment options

Answer selected by hus-o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants