Fullscreen Lightbox Javascript Fullscreen Lightbox ,React Fullscreen Lightbox Vue

React Lightbox Documentation

Learn how to use the React version of Fullscreen Lightbox.

Updating props

The lightbox is not reactive to props changes other than "toggler" and slide control props. The lightbox component has to be remounted to update them. In most cases the best solution is to use the React's "key" prop—after updating this prop, React remounts the component.
In the following example it is presented how the "sources" prop can be updated:

function App({ productsImages }) {
const [toggler, setToggler] = useState(false);
const [productIndex, setProductIndex] = useState(0);

return (
<>
<button onClick={() => setToggler(!toggler)}>
Open the lightbox.
</button>
<button onClick={() => setProductIndex(1)}>
Load the second product.
</button>
<FsLightbox
toggler={toggler}
sources={productsImages[productIndex]}
key={productIndex}
/>
</>
);
}
Look over the Fullscreen Lightbox open source plug-ins.