Peter Evjan

Peter Evjan

Retrieving query parameters in Next.js

Lots of advice out there is old, this is how easy it is in Next.js 11!

export default function YourPageName(props) {
  // Do something interesting to your query params

export async function getServerSideProps(context) {
  // You could make a request somewhere here with
  // the query params in context.query

  return {
    props: { query: context.query },