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

196
Views
Reaccionar router dom con mecanografiado usando coincidencia

Estoy usando React Router Dom versión 5 con React v 17 y con TypeScript. Estoy tratando de averiguar cómo usar el objeto de match . Hasta ahora tengo:

 import { BrowserRouter, Route, Switch, match } from 'react-router-dom'; interface DetailsProps { match?: match<string> ; } const Routing: React.FunctionComponent<DetailsProps> = (props: DetailsProps) => { const match = props.match; // more routes here <Route path={`${match.url}`} render={() => <Component/>} /> }

Aparece el error: el objeto es posiblemente 'indefinido'.

¿Alguna idea de por qué? esta mal el tipo?

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

0

Puedes importarlo:

 import { match } from 'react-router-dom';
about 4 years ago · Juan Pablo Isaza Report

0

Su interfaz dice que la match es un parámetro opcional y puede no estar undefined

 interface DetailsProps { match?: match<string> ; }

¿Quitando ? marque lo hará obligatorio:

 interface DetailsProps { match: match<string> ; }
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!