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

636
Views
¿Hay un equivalente para {useLocation} de 'react-router-dom' en nextjs?

import { useLocation } from 'react-router-dom';

Actualmente estoy usando Nextjs, necesito ayuda para un equivalente de useLocation

`

 import Link from 'next/link'; import { FC } from 'react'; import {useRouter} from 'next/router'; import { useStore } from '../store';` const PrivateRoute: FC = ({ children }) => { const currentUser = useStore((state) => state.currentUser); const location = useRouter();` if (!currentUser) return ( <Link href={`/sign-in?redirect=${encodeURIComponent( location.pathname + location.push('chat') )}`} /> ); return <>{ children }</>

}

exportar ruta privada predeterminada;

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

0

Puede usar useRouter desde 'next/router' y luego puede usar pathname o asPath y luego agregar condicionalmente slug o params. El resto puede encontrar más información a través de la documentación publicada por otros.

about 4 years ago · Juan Pablo Isaza Report

0

Sí, puede usar useNavigate en react-router-dom v6 y puede usar useHistory en react-router-dom <v6

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!