इसे छोड़कर कंटेंट पर जाएं

Invalid value for getStaticPaths route parameter.

यह कंटेंट अभी तक आपकी भाषा में उपलब्ध नहीं है।

GetStaticPathsInvalidRouteParam: Invalid getStaticPaths route parameter for KEY. Expected undefined, a string or a number, received VALUE_TYPE (VALUE)

Since params are encoded into the URL, only certain types are supported as values.

/route/[id].astro
---
export async function getStaticPaths() {
return [
{ params: { id: '1' } } // Works
{ params: { id: 2 } } // Works
{ params: { id: false } } // Does not work
];
}
---

In routes using rest parameters, undefined can be used to represent a path with no parameters passed in the URL:

/route/[...id].astro
---
export async function getStaticPaths() {
return [
{ params: { id: 1 } } // /route/1
{ params: { id: 2 } } // /route/2
{ params: { id: undefined } } // /route/
];
}
---

See Also:

Contribute

आपके दिमाग में क्या है?

Community