Using searchParams in Server Component Page causes the whole page to be Dynamic.
Answered
Morelet’s Crocodile posted this in #help-forum
Morelet’s CrocodileOP
The title is self-explanatory: is there a way to generate the searchParams using
generateStaticParams or similar function?Answered by Asian black bear
Short: no. That’s not what search parameters are designed for.
9 Replies
Asian black bear
Short: no. That’s not what search parameters are designed for.
Answer
Asian black bear
You’d have to resort to path parameters.
Morelet’s CrocodileOP
Thanks: aren't they designed, for example, to tell the current page in a pagination? @Asian black bear
Asian black bear
Search params are designed to dynamically filter, yes.
Morelet’s CrocodileOP
e.g.
ecc
www.example.com/store?page=1www.example.com/store?page=2ecc
Asian black bear
That’s nothing you statically match because search params are a dynamic parameter attached to the request
Morelet’s CrocodileOP
Gotcha, so if I want to statically generate pages as per the previous example I would have to go with
store/[page]Asian black bear
Yes.
Morelet’s CrocodileOP
Thanks