Next.js Discord

Discord Forum

how to return number from generateStaticParams

Answered
Chris AmoremFunem (He/Him) posted this in #help-forum
Open in Discord
Hi,
My ids are all numbers if I use generateStaticParams and use return cat.id I get the error - a required parameter (id) was not provided as a string in generateStaticParams
Answered by Cape horse mackerel
well, if you go to the https://nextjs.org/docs/app/api-reference/functions/generate-static-params#returns you'll see that generateStaticParams return type is string so probably you should convert your id to string
View full answer

2 Replies

Cape horse mackerel
well, if you go to the https://nextjs.org/docs/app/api-reference/functions/generate-static-params#returns you'll see that generateStaticParams return type is string so probably you should convert your id to string
Answer