Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

291
Vistas
What is the benefit of SSR: true prop with dynamic imports?

What is a difference between dynamic imported component with ssr: true:

const DynamicButton = dynamic(() => import('./Button').then((mod) => mod.Button), {
  ssr: true,
});

and just normal component import:

import { Button } from './Button';
  • What is the benefit of one over the other?
  • Where do we put load on?
  • For scenario below (JSX example), if showButton is false, did we still load DynamicButton and where?

// jsx
return showButton && <DynamicButton />
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Regular import

When using a regular component import, Next.js bundles the component's code together with the rest of the components for a given route. This usually means you end up with a big chunk containing all the components code for each route.

next/dynamic with ssr: true

When using next/dynamic with ssr: true, Next.js splits the component's code into a separate chunk (code splitting) and loads that chunk separately (lazy loading).

This means that for the scenario that you described:

return showButton && <DynamicButton />

The DynamicButton component only gets loaded when showButton is truthy. This has the benefit of reducing the amount of JavaScript that's loaded on initial page load.

next/dynamic with ssr: false

When using next/dynamic with ssr: false, all the above benefits of the dynamic import also apply. However, the component's code will not get preloaded on the server and will only run on the client. This is typically useful when the component includes a library or API that only works in the browser.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda