Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

78
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!