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}
/>
</>
);
}