am building a React image gallery with next and previous buttons so users can click to go to the next image and the previous image. but it does not work.
Can you share any other troubleshooting information? Like console.log() outputs, browser console messages anything at all that shows the behaviour or what troubleshooting you’ve done?
You just wrote all this code and nothing happened?
Can you share your updated code so we can see where you added the console.log() lines?
If it shows nothing, add more console.log() lines to see where the program stops. You can add one at the very beginning to make sure that your code runs at all.
console.log("Code starts executing")
This is a basic troubleshooting technique that you should be using
For the first code. Where did you see ReactImageMagnify accepting the two props you are passing currentIndex to? Besides, the component lib doesn’t seem to have anything to do with a carousel/slideshow.
In the second code you posted, you are using currentIndex for is a class name, and we have no way of knowing what that does. A carousel/slideshow is usually a container with a scroll overflow where you move the content using a transform.