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

144
Visualizações
Is it memory intensive to store react components in an object?
{
    ui: <Component />,
}

What if an object stores hundreds of these components. Would this be memory intensive?

about 4 years ago · Santiago Gelvez
2 Respostas
Responde à pergunta

0

It would be no more memory intensive than displaying them in the UI. Behind the scenes, React stores the components as objects, so there is no performance cost.

about 4 years ago · Santiago Gelvez Relatório

0

The code <Component /> transpiles to React.createElement(Component, null);, which will return an object that looks roughly like this (dev builds may include extra properties to help with debugging):

{
  $$typeof: Symbol(react.element)
  key: null,
  props: {}
  ref: null,
  type: Component,
  _owner: null,
}

Of those, the props and the type are the only things that could conceivably have a significant memory footprint. But Component is very likely referenced somewhere else anyway, so i doubt it can be garbage collected whether you create this element or not.

In short, i'd say the memory is only a problem if both of the following are true: 1) the props are very large, and 2) the props would be garbage collected if not for this element.

about 4 years ago · Santiago Gelvez 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