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

196
Visualizações
How to pass Data From React Router through props? I am unable to do it

Hey I am Practicing a contact List in React The problem i am facing I am unable to pass props in react router with route it work fine but when i Try to render it through React Router i got nothing

   function App(){
const[contactdata,setcontactdata]=useState(GetLocaldata());
  return (
 
 <div className="ui container App">
{/* <Header/>
<AddContact  AddChangeHandler={AddChangeHandler} />
<Contactlists Contact={contactdata} deletehandler={deletehandler} /> */}

<Router>
<Header/>
<Routes>
<Route path="/" render=
{(props)=><Contactlists {...props} 
Contact={contactdata} deletehandler={deletehandler} /> }
/>
<Route path="/add" render=
{(props)=><AddContact {...props}  AddChangeHandler={AddChangeHandler}/>} />
<Route path="/de" element={<ContactDetail/>} />
 </Routes>
 </Router>
   </div>
   );

 
}
about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

In previous versions of react-router-dom you'd have to use Route's component render prop to pass in props because React router dom was in charge of creating the React element. However, since RRDv6 (which I assume is the version you're using) you just need to pass the props as you normally would:

<Route path="/your-path" element={<YourComponent someProp={someProp} />} />

Let me know if that helps you.

about 4 years ago · Santiago Gelvez 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