Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

127
Vistas
Next.js Query param get lost on page refresh

I have 2 components and i need to route between them and passing data from the first to the second and not send the param in the url. but my problem is when I refresh the page the query params get lost.

 <p className={styles.jobname}>
        <Link
          href={{
            pathname: `alyDeal/` + `${jobId}`,
            query: {
              jobName,
              desc,
              subcat,
              city,
              est,
              bids,
              userId,
              name,
              picture,
              jobId,
              jobImages,
              budget,
              neigh,
              score,
              phone,
              email,
              deadline,
              jobAddress,
              createdAt,
              ownedBus,
              category,
            },
          }}
          as={`/alyDeal/${jobId}`}
          passHref={true}
        >
          {jobName}
        </Link>
      </p>

and in the second component

export const getServerSideProps = async (context) => {
  {
    const { query } = context;
    return { props: { query } };
  }

const { query } = props;
  console.log(query);

and the query always returns only the id that I'm passing directly into the URL but not the rest of the query object

Any solutions? };

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

Why don't read the query directly in the page? You don't need to use props.

function MyComponent() {
  const router = useRouter()
  const { query } = router

  // use the query data

  return (
    <div>JSON.stringify(query)</div>
  )
}
about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda