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

143
Visualizações
Confusion about code splitting and lazy loading in React

I was looking into code splitting and lazy loading in the react docs where it mentions that

The lazy component should then be rendered inside a Suspensecomponent, which allows us to show some fallback content (such as a loading indicator) while we’re waiting for the lazy component to load.

I am not super clear on the meaning of `load` here - does it mean loading into the memory or fetching over the network and load into the memory?

If it defers the fetching, then how do we know which endpoint to hit to fetch the split chunk from when the component is needed?

I came across this demo on codesandbox where it has every tab lazily loaded

const Tab1 = lazy(() => import("./components/tabs/Tab1"));

const Tab2 = lazy(() => import("./components/tabs/Tab2"));

const Tab3 = lazy(() => import("./components/tabs/Tab3"));

const Tab4 = lazy(() => import("./components/tabs/Tab4"));

But by checking the network tab, I don't see new requests coming out when I switched the tabs. Am I missing the point of code splitting and lazy loading here?

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