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

210
Visualizações
Why redirect not working in next.js application?

I am new to next.js and i have an application built on top of it. I run a timer of 10 seconds on the homepage and when the timer reaches 0 I want otredirect user to a feedpack page in my pages folder.

Code for the same:

if(timer==0)
  {
    navigate('/feedback')
    clearTimeout(time);
  }

I am using useNavigate hook here and it gives me the following error:

useNavigate() may be used only in the context of a <Router> component.
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Here you can read more about this error

What you need is to use useRouter hook.

import { useRouter } from 'next/router'

if(timer==0)
{
  router.push('/feedback')
  clearTimeout(time);
 }
about 4 years ago · Juan Pablo Isaza 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