DEV Community

Discussion on: Fixing Next.js router query param returning undefined on initial render

Collapse
 
brewpy profile image
Brewpy App

How to do it for SSR pages?

Collapse
 
codedsalis profile image
Kadiri Talitu (Coded Salis)

No need to use it for SSR pages. In your getServerSideProps, there's a context parameter that returns the route query. You can get it by calling context.params.query where query is the query parameter. e.g: www.example.com?q=what+is+your+name
q in the URL above is the query parameter