#Folder Structure
1 messages · Page 1 of 1 (latest)
To support URLs like /scenario/2 in the App Router, you need a dynamic route segment.
- Create a
scenariofolder insideapp. - Inside
scenario, create a dynamic segment folder[id](or[slug], name is up to you). - Inside that folder, add a
page.tsx.
Your structure would become:
src/
app/
actions/
scenario.ts
api/
inngest/
route.ts
scenario/
[id]/
page.tsx
globals.css
layout.tsx
page.tsx
Then in src/app/scenario/[id]/page.tsx:
export default async function ScenarioPage({
params,
}: {
params: Promise<{ id: string }>
}) {
const { id } = await params
// use `id` to load the scenario, e.g. scenario 2
return <div>Scenario {id}</div>
}