#Dynamic routes rendering dynamic components

3 messages · Page 1 of 1 (latest)

willow pulsar
#

Hello, I need some help to achieve is the following in the most efficient way, I haven't found anything like this on the web:

(Nextjs13, app directory)

I have tools stored in a db (prisma, mongodb), my tool object looks like this: name, slug, aliases.

When you access my app under example.com/[slug] it looks in the db for a tool with the same slug as given, it then gets the component that needs to be render and renders it (see screenshot 1).

In my layout, I fetch my tool, again from the given slug, and return metadata (name, description etc...), its in my page.jsx where I get the right component for the right slug.

Want I want to do is to have all the aliases of a specific tool "point" to the principal slug component, thats why you say many case === aliase return Component in my getToolComponent().

Is there a more efficient way to do this? I don't want to have many cases for the same tool, its dumb...

#

page.jsx