Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

140
Visualizações
How do get params that have no specific names

I have been trying to find how to get multiple params in react and in most of the examples the params have names like :id e.g

to="/movie/:id"

So to get such you just use:

const {id} = useParams();

But for my case i don't have specific names. How to i get these params?

//res is an object
<Link to={`/movie/${res.id}/${res.link_id}`}>
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

I have figured it out. I confused <Route> with <Link>

In the <Link> tag i don't need to define the params. It is the <Route> tag that the params are already defined i.e

<Route path='/movie/:movieId/:linkId' element={<Movie />} />

//Then in link tag is just an like an <a> tag
<Link to={`/movie/${res.id}/${res.link_id}`}>

Then in my component I just get them as

const {movieId,linkId} = useParams()
about 4 years ago · Juan Pablo Isaza Relatório

0

You have to assign the component in the Link props: Suppose that your new Component is named MovieDetails.

const MovieDetails=()=>{
    const {id} = useParams();
}

Link Component:

<Link to={`/movie/${res.id}/${res.link_id}`} component={MovieDetails}>
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda