Search Params async /await bug?
Answered
Cornish Rex posted this in #help-forum
Cornish RexOP
Hey guys im trying to access the search params simply as mentioned from the docs exactly:
Doing that shows:
removing await i get:
Nextjs 15, any idea what the issue here is?
const page = async ({ searchParams }: SearchParamsProps) => {
console.log(await searchParams);
}Doing that shows:
'await' has no effect on the type of this expression.removing await i get:
Error: Route "/shop" used `searchParams.page`. `searchParams` should be awaited before using its properties. Learn more: https://nextjs.org/docs/messages/sync-dynamic-apisNextjs 15, any idea what the issue here is?
3 Replies
Make the searchParams in there a Promise and you’ll be good
Cornish RexOP
Didn't really know that is possible! thank you 🙂