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

598
Visualizações
SSRProvider is not working in my NextJs app

My app is built using NextJs with Typescript and using the react-bootstrap library for components. I keep getting an error that says When server rendering, you must wrap your application in an <SSRProvider> to ensure consistent ids are generated between the client and server.

I tried to include the SSRProvider that comes with react-bootstrap, but it doesn't seem to be working no matter where I put it in my _app.tsx file. Anyone know how to resolve this? My UI keeps breaking when reloading the page.

import type { NextComponentType } from 'next';
import { AppContext, AppInitialProps, AppLayoutProps } from 'next/app';
import { ReactNode } from 'react';
import { ThemeProvider } from 'styled-components';
import theme from '../styles/theme';
import { SSRProvider } from 'react-bootstrap';

const MyApp: NextComponentType<AppContext, AppInitialProps, AppLayoutProps> = ({
  Component,
  pageProps,
}: AppLayoutProps) => {
    const getLayout = Component.getLayout || ((page: ReactNode) => page);

  return (
      getLayout(
      <SSRProvider>
        <ThemeProvider theme={theme}>
          <Component {...pageProps} />
        </ThemeProvider>
      </SSRProvider>
      )
    )
}

export default MyApp;
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Fixed this by wrapping the entire return statement in the <SSRProvider> tag. Last time I tried that, I forgot to wrap the getLayout() statement in curly braces. Here is the code for anyone running into the same issue.

return (
      <SSRProvider>
      {getLayout(
        <ThemeProvider theme={theme}>
          <Component {...pageProps} />
        </ThemeProvider>
      )}
      </SSRProvider>
    )
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