Next.js Discord

Discord Forum

Dynamic routing

Havana posted this in #help-forum
Open in Discord
Hi, I'm creating the dynamic routing for services pages in app router, /services/[page].tsx

I Have all the data for the pages in my local folders itself. how should i import those in dynamic routing?

Here is the code snippet:
import data from "@/content/uk/services/legal/data.json";

export default function ServicePages({ params }: { params: { slug: string } }) {
  const { content, meta } = data;
  return (

I want to import sub-services pages data something like @/content/uk/services/${params.slug}/data.json

How should i do it?

1 Reply

What do you by having data in local folders? Is the data in a json file? Or are they components?