Next.js Discord

Discord Forum

using data from a json array to populate dynamic route page

Unanswered
Singapura posted this in #help-forum
Open in Discord
SingapuraOP
So I want every page in the app directory that my button links to links to link to a unique route based on the id of the json object, that contains information specific to that json object. In this case, I would like to display the image for the specific id in page.tsx in the [id] dynamic route

1 Reply

SingapuraOP
I solved it by passing params as a prop to the functional component, then I destructured the id from the prop like this, then used the javascript find function to get the data from the json object with the destructured id like this