Next.js Discord

Discord Forum

How should I implement prev & next in Image app

Black Caiman posted this in #help-forum
Open in Discord
Black CaimanOP
I was trying to clone
I'm almost there, Just one thing is missing from website. that is, when i click on an image from image-grid, I need next and prev buttons right next to modal.

Main issue is, Image-grid is renders a list of images. These images data is in homepage.
When user clicks on one of the image, we open a modal at /image/<ID> (if user refreshes, it becomes whole page)
That modal should have < & > buttons on left and right, to directly visit other images without closing modal and clicking on next image.
But the image list data is in / (homepage) itself, so idk how to get that in /image/<ID> page.

I'm really stuck at this stage for a while now. Any hints will be appreciated.

PS: I got the modal working itself, thanks to Parallel & Intercept routes.

Thanks in advance 🙏

0 Replies