Next.js Discord

Discord Forum

Dynamic Params with Precompiled MD Files in Next.js

Unanswered
Chartreux posted this in #help-forum
Open in Discord
ChartreuxOP
I'm working with Next.js and trying to figure out how to create dynamic params based on precompiled Markdown (MD) files. In Next.js, these files are essentially transformed into JSX elements. Here's a snippet of my current approach:

import Hello from './hello.md'
const Page = () => {
    return (
        <Fragment>
            <Nav />
            <Hello />
        </Fragment>
    );
}

As you can see, I'm directly using the imported MD file as a JSX component (<Hello />) instead of accessing its original Markdown data. My question is, how can I integrate this setup with my existing repository, especially in terms of working with generateStaticParams() and dynamic routes like "https://nextjs.org/docs/app/building-your-application/routing/dynamic-routes"

0 Replies