How to access the parent page's slug?
Answered
Asian paper wasp posted this in #help-forum

Asian paper waspOP
I have a topic and page number. I want fetch the topic and the page number from an API but I don't know how to access the topic from the [pageNumber] page. How should I do it?
type Props = {
params: {
pageNumber: string;
};
};
export default function TopicPage(props: Props) {
return <div>TopicPage</div>;
}

Answered by not-milo.tsx
You don't need to do anything. It will be passed down to your page as part of its parameters.
See: https://nextjs.org/docs/app/building-your-application/routing/dynamic-routes#typescript
Here you can see a clear example. Plus at the top of the page you can find this piece of text:
See: https://nextjs.org/docs/app/building-your-application/routing/dynamic-routes#typescript
Here you can see a clear example. Plus at the top of the page you can find this piece of text:
Dynamic Segments are passed as theparams
prop tolayout
,page
,route
, andgenerateMetadata
functions.
2 Replies

You don't need to do anything. It will be passed down to your page as part of its parameters.
See: https://nextjs.org/docs/app/building-your-application/routing/dynamic-routes#typescript
Here you can see a clear example. Plus at the top of the page you can find this piece of text:
See: https://nextjs.org/docs/app/building-your-application/routing/dynamic-routes#typescript
Here you can see a clear example. Plus at the top of the page you can find this piece of text:
Dynamic Segments are passed as theparams
prop tolayout
,page
,route
, andgenerateMetadata
functions.
Answer

Asian paper waspOP
Thank you @not-milo.tsx