Skip to content

Can't use useLightboxState #128

Answered by igordanchenko
Bravemobin asked this question in Q&A
Discussion options

You must be logged in to vote

You probably want to use the on.view callback in this case.

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

Here is an example demonstrating how you can dynamically add slides to the lightbox - https://codesandbox.io/p/sandbox/yet-another-react-lightbox-128-7mczyy?file=%2Fsrc%2FApp.tsx

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@Bravemobin
Comment options

@igordanchenko
Comment options

Answer selected by igordanchenko
@igordanchenko
Comment options

@Alireza-Ghavabesh
Comment options

@Alireza-Ghavabesh
Comment options

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