When is generateStaticParams even needed?
Unanswered
Polar bear posted this in #help-forum
Polar bearOP
With generateStaticParams I can prerender dynamic pages at build time, say using values from a DB. But I feel like in most cases I would be continuing to add such values to the DB while the server is running, so I would still need to render pages at runtime which I would probably cache. Once these pages have been cached I get the same performance as those rendered at build time with generateStaticParams. So the only benefit of generateStaticParams over relying on caching is that the first (and only first) person to request that page since build gets an already prerendered page. This feels like a very small case. Have I misunderstood something? If not, can you list some real world examples where generateStaticParams is significantly useful? Thanks
2 Replies
generateStaticParams
is useful because it allows to you statically generate pages for dynamic params that you known the values for and dynamically render any that are added later on or unkown to the function during runtime.It provides the best of both worlds, fast static generation for values known at build time, and dynamic generation for values only known at runtime