You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Or is the only way to access paramters from context.params using getStaticProps or getServerSideProps ?
Thanks.
Edit : Seems related to #55 , when I export getStaticProps or getServerSideProps, even without returning context.params useRouter().query is populated but if not I got the error described there and an empty object.
The text was updated successfully, but these errors were encountered:
Or is the only way to access paramters from context.params using getStaticProps or getServerSideProps ?
Yes, that's the only way as in those two scenarios because the query object data isn't coming from the browser but from the build (getStaticProps) or the incoming request (getServerSideProps), if the page is static then there's no way to know about dynamic params before hydration (meaning you can only know the query params after the initial render)
When rewriting through
next.config.js
as explained here https://nextjs.org/docs/api-reference/next.config.js/rewrites it was possible to get query parameters fromuseRouter().query
but when using rewrites via _middleware.ts withNextResponse.rewrite(path)
as shown in this example https://github.com/vercel/examples/blob/main/edge-functions/hostname-rewrites/pages/_middleware.tsuseRouter().query
is an empty object.Or is the only way to access paramters from
context.params
using getStaticProps or getServerSideProps ?Thanks.
Edit : Seems related to #55 , when I export getStaticProps or getServerSideProps, even without returning
context.params
useRouter().query is populated but if not I got the error described there and an empty object.The text was updated successfully, but these errors were encountered: