79780869

Date: 2025-10-02 11:36:01
Score: 0.5
Natty:
Report link

The bug it's setGalleryImg(`img${e.target.id}`);

That sets the state to the literal string "img1" / "img2"… not to the imported image module (img1, img2, etc.). As a result, React tries to load a URL literally called img1, which doesn’t exist, so the image “disappears”.

Use the useEffect to log your useState

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Pedro Henrique Cndido Ferreira