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

108
Visualizações
isReady is true from next/route when using getInitialProps

In my application I'm using nextjs and I'm transition my app from static to SSR. On my custom App I introduced the getInitialProps function and I noticed that when I use getInitialProps function, my property isReady from the hook useRouter() is always true and the query object is empty when I have query parameters on the url.

Example:

const App = ({ Component, pageProps }: AppProps): JSX.Element => {   
   const router = useRouter()
   
 useEffect(() => {
    console.log('App route: ')
    console.log(router)
    console.log(router.isReady)
    console.log(router.query)

  }, [router])

 return ({router.isReady && <Component {...pageProps}/>})
  
}

On this scenario, what happens is that the query params "appear" later, and the console logs are printed twice due the later hydration (what makes sense). But shouldn't the isReady flag be false? on the first console? after the hydration?

about 4 years ago · Juan Pablo Isaza
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