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

125
Views
How to deliver data on the link tag of react-router-dom v6

When I put the state value in the link prop of the react router dom, I want to use the data I put in the state when the link was executed in the moved component, but I don't know how.

When console.log(location;), I want to see the wordlist in the state value.

<Link
  to={{
    pathname: `/test/${wordlist[0]?.contents}`,
    state: {
      wordlist: wordlist,
    },
  }}
>
  <ColorButton>test</ColorButton>
</Link>
export default function Test(props) {
  const location = useLocation();
  console.log(location);
return()
}

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

0

In react-router v6, state is passed as a prop in Link component:

<Link
  to={`/test/${wordlist[0]?.contents}`}
  state={{ wordlist }}
>
  <ColorButton>test</ColorButton>
</Link>
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!