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

243
Views
incapaz de definir navegar = useNavigate()

Estoy tratando de ejecutar este código:

 const navigate = useNavigate() <div> <button onClick={() => navigate("/")}>CLICK</button> <h1>HATS PAGE</h1> </div> );

pero de alguna manera const navigate = useNavigate() me da un Parsing error: Unexpected token

¿Alguien podría ayudarme con este problema?

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

0

No puede poner sus declaraciones que definen variables en medio de una expresión JSX.

Defina sus variables primero. Luego haz tu JSX.

 const navigate = useNavigate(); return ( <div> <button onClick={() => navigate("/")}>CLICK</button> <h1>HATS PAGE</h1> </div> );
about 4 years ago · Juan Pablo Isaza Report

0

Los ganchos deben llamarse en el nivel superior de su componente funcional React.

 function ComponentName() { const navigate = useNavigate(); return ( <div> <button onClick={() => navigate("/")}>CLICK</button> <h1>HATS PAGE</h1> </div> ); }
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!