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

139
Views
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 answers
Answer question

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 Report

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 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!