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

103
Views
How to pass function using react router v6

I know we can pass value through route by state:

<Link state ={someItem:""}/>

or use useNavigation()

const nav = useNavigation()
const navTo =  () =>{
   nav("somePage",{state:{someItem:""}}
}

But whenever i try to pass function like

const [state1,setState1] = useState('')

And i pass through state <Link state ={function:()=>{setState(123)}}/>

It will always return null

{
    "pathname": "/search",
    "search": "",
    "hash": "",
    "state": null,
    "key": "default"
}

So my question is how to pass function through react-router (V6)

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

0

How now to pass value to components?!

    <Route exact path='/component' render={() => <myComponent prop={value}/>} />

How to make it that when loading it goes directly to the '/component' page, and not to '/'?!

<Redirect exact from='/' to='/component'/>
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!