#Retrieving data - Next.js 14 Server Components 🫤

15 messages · Page 1 of 1 (latest)

rough wedge
#

Hey,

I just switched to Next.js 14 and its server components. Need some tips on pulling data the right way. I’ve got this page listing all my data entries in a table. Now, I want to make it so that when you click on any entry, it grabs the ID and takes you to a new page showing more about it. It'll hit my API with that ID to get the details.

Im not sure if I need to create a dynamic page [id].tsx, Pass the id as a route param to my /details page.tsx, or use some weird server component that will get my data magically.

Any advice on this would be great. Sick to death of banging my head against the wall with these silly server components

pure trailBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

tough grove
#

Yup, you will make a dynamic page [id].tsx for the individual pages.

rough wedge
#

Why do I get 404 for http://localhost:3000/creation/ai-detail/123

tough grove
#

the folder has to be [id]

#

and inside it is page.tsx

rough wedge
#

wow super fast reply you legend

tough grove
#

need them points :D

#

works now?

rough wedge
#

this looking ok?

tough grove
#

where did you import router from btw

rough wedge
#

legendddddd

#

Working