Dynamic routing
Unanswered
Havana posted this in #help-forum
HavanaOP
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:
I want to import sub-services pages data something like
How should i do it?
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 (
<>
<section>
<h1>{content.hero.title}</h1>
<p>{content.hero.description}</p>
</section>
</>
);
}
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?