How to get query params using Server component (next 13)

clock icon

asked 9 months ago.

Answers

0 Answers

eye

5 views

Next13 is out, and they advise to use the new app directory where every component is by default a "Server Component"

Inside a "server Component", you can use:

  • async/await to fetch data.
  • cookies() to retrieve cookies
  • headers() to retrieve request headers.

But I can't find how to retrieve query params.

Before Next 13, within getServerSideProps, you could use context.query to access the query params.

Do you know how to retrieve query params using "server Component" in Next 13.

0 Answers

Write your answer here

Top Questions