sukhesh
sukhesh
TTCTheo's Typesafe Cult
Created by sukhesh on 4/17/2025 in #questions
How to await params?
Hello, scoured stackoverflow and enlisted the help of some LLMs but couldn't figure this out (maybe i need sleep). I get the error: Error: Route "/[baseId]" used params.baseId. params should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apis at ProjectPage (src/app/[baseId]/page.tsx:14:24) 12 | export default async function ProjectPage(promise: Promise<{ params: { baseId: string } }>) { 13 | const { params } = await promise;
14 | const baseId = params.baseId;
| ^ 15 | 16 | if (!baseId) return notFound(); 17 | For this method in my modal page.tsx /[baseId]:
export default async function ProjectPage({ params }: { params: { baseId: string } }) {
...
const base = await caller.base.getFullBase({ id: params.baseId });
if (!base) return notFound();
...
return (
...
);
}
export default async function ProjectPage({ params }: { params: { baseId: string } }) {
...
const base = await caller.base.getFullBase({ id: params.baseId });
if (!base) return notFound();
...
return (
...
);
}
(My code works but I would like to not get an error)
4 replies