Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

299
Views
No se pueden agregar parámetros de consulta a la ruta dinámica nextjs

Tengo un archivo llamado. [slug].js .

lo que estoy tratando de hacer es que quiero agregar un parámetro de consulta a esta ruta dinámica, este es el código.

 await router.replace({ pathname: `${router.pathname}`, query: { coupon }, }, undefined, { shallow: true });

Esto funciona bien en todas las páginas estáticas, pero en la página dinámica me da este error:

 Error: The provided `href` (/home/[slug]?theme=dark) value is missing query values (slug) to be interpolated properly. Read more: https://err.sh/vercel/next.js/href-interpolation-failed

alguna sugerencia por favor?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Use router.asPath para obtener la dirección de la página actual:

 router.replace({ pathname: `${router.asPath}`, query: { coupon }, }, undefined, { shallow: true });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!