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

118
Views
Renderizar un componente en una sección específica de la página

Componente principal.jsx

 //other code <CardGroup> <Router> {cards.map((value,idx) => { return <TutorialCard key={idx} val={value} /> })} <Switch> <Route path="/subject/:title" children={(props)=>{<ContentPage {...props}/>}}/> </Switch> </Router> </CardGroup> //other code

ContentPage.jsx

Quiero mostrar este componente en una sección específica/nueva página.

 export default function CotentPage(props){ return <h1>This is content page-{props.match.params.title}</h1> }

TutorialCard.jsx

 //this component create links. export default function tutorialCard({ val }) { return ( <Card border="primary" style={{ width: '18rem' }} className='cards'> <Link exact to={`/subject/${val}`}> <Card.Header className="text-center"> <h6>{val}</h6> </Card.Header> <Card.Body> <img src={cardSvg} className="fitImage"></img> </Card.Body> </Link> </Card> ); }

Estos son enlaces generados por el componente TutorialCard.jsx Después de hacer clic en estos enlaces, muestra ContentPage además de los enlaces. Pero quiero representar ContentPage en una nueva página. ¿Cómo puedo conseguir esto? ¡Por favor ayuda!

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

0

La razón es que las tarjetas se procesan independientemente de sus rutas. Necesitas renderizar tus tarjetas en otra ruta. Al igual que:

 <Router> <Switch> <Route path="/" exact children={() => (cards.map((value, idx) => <TutorialCard key={idx} val={value} />))} /> <Route path="/subject/:title" children={(props) => <ContentPage {...props} />} /> </Switch> </Router>
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!