Next.js Discord

Discord Forum

type of page props nextjs

Answered
American black bear posted this in #help-forum
Open in Discord
Avatar
American black bearOP
Hello everyone,
is there a better way to do the following, eg with a built in props. I can't find one

export type ExercisePageProps = {
  params: { id?: Exercise["id"] };
  searchParams: { from?: string; to?: string };
}; // surely there is a built in props for that

const Page = async (unsafeProps: ExercisePageProps) => {
return (...)
}
Answered by risky
Nextjs currently doesn't have a method for knowing the params (for dynamic routes)... we have a community one tho https://discord.com/channels/752553802359505017/1159366767358005278/1159366839298691084
View full answer

3 Replies

Avatar
risky
Nextjs currently doesn't have a method for knowing the params (for dynamic routes)... we have a community one tho https://discord.com/channels/752553802359505017/1159366767358005278/1159366839298691084
Answer
Avatar
risky
You would still have to type searchparams as know one knows what it is
Avatar
American black bearOP
yeah that makes sense. Thanks for your help 🙌