How to access the parent page's slug?
Answered
Asian paper wasp posted this in #help-forum
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
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>;
}
![Image](https://cdn.discordapp.com/attachments/1129173037862879242/1129173038009688244/image.png)
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
![Avatar](https://cdn.discordapp.com/avatars/548149742207631360/2b1e750ac12613e7f54964225371f39b.webp?size=256)
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.
Answer
![Avatar](https://cdn.discordapp.com/embed/avatars/4.png)
Asian paper waspOP
Thank you @not-milo.tsx