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

79
Vistas
Does React clean used memory for States?

Suppose that, I should store a lot of data in component's local states with useState(). Logically React uses memory to store these data. But what does happen when one component unmount? Does React clean used memory for old states in unmounting step? or JavaScript keeps all states in memory until I close tab or refresh page?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

React does nothing with the memory.

JavaScript manages memory allocation and deallocation by his own. This is known as garbage collection

Answering your question - in most cases JS will free the memory by himself when it's needed by removing not accessible objects.

However, sometimes you can prevent JS from freeing memory. This is known as memory leaks

If component use 1MB of memory for states, React will free all 1MB of memory after unmounting?

Most of all - no. Garbage collection will start in undermine moment, somewhere in the future

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