You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Swapping images does not work when there are multiple instances of the same image in the collage. This is because swapping uses the URL of the image for indexing, if there is a duplicate image, then two identical URLs exist in the images array and this will cause strange behaviour when swapping.
Solution
A possible solution would be to build a local state array from the images prop each with unique IDs, then use the unique ID to identify each image when swapping.
Steps to Reproduce
Build a collage with duplicate images.
The text was updated successfully, but these errors were encountered:
Description
Swapping images does not work when there are multiple instances of the same image in the collage. This is because swapping uses the URL of the image for indexing, if there is a duplicate image, then two identical URLs exist in the images array and this will cause strange behaviour when swapping.
Solution
A possible solution would be to build a local state array from the
images
prop each with unique IDs, then use the unique ID to identify each image when swapping.Steps to Reproduce
Build a collage with duplicate images.
The text was updated successfully, but these errors were encountered: