Can't use useLightboxState #128
-
when I try to use useLightboxState() next js give me this error
and next I use give me this error
I have no idea what should I do |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 5 replies
-
Lightbox hooks can be used only in a component rendered inside the lightbox (i.e., custom button, or any other component you add to the lightbox with a plugin). if you want to access the lightbox state outside the lightbox, you can use the Controller ref. Can you share your draft, and describe what are you trying to implement? |
Beta Was this translation helpful? Give feedback.
You probably want to use the
on.view
callback in this case.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