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

275
Visualizações
Still render the page if the components code has error - React/Nextjs

I haven't got much experience in React, would really appreciate any advice. My situation is that:

  • I have a dynamic page let say the url is mysite/[productid]
  • The page is the combination of component A, B and C
  • There is an error happened in component B and React render 404 page which I don't want to.

My question is: Is there any way in React/Nextjs to still render the page (the page still displays without the error component) if one the components scratch, and log the error using Sentry? As I know there is a way to do that with Emberjs.

I do not want to render another error page with error boundary as it does not make sense to take down whole page with only one error component.

Thank you in advance.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There are two solutions to handling errors in a React application:

  • JavaScript Exception Handling i.e. try/catch
  • React Error Boundaries

If a component can recover from an error internally, then the expressions which may throw that error should be wrapped in a try/catch block. Otherwise, you can use React Error Boundaries to manage any errors in child components.

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