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

142
Views
React useContext and useMeo: State in Context is not updating

I have a Grid of which every cell accesses an update function onClick to mark the cell as clicked. During to the fact that I need to access the data of which cells are clicked later somewhere else I created a Context. I noticed the performance is getting very bad with a huge grid I wanted to minimize rerenders and wrapped the Cell Component called Node in useMemo so that it only rerenders if the className changes which colors the cell yellow if clicked. My Problem is that if I click on one cell it gets colored yellow but as I click on a second Cell the state Hook in the stateContexts.js doesnt remember the first clicked cell. If someone knows how to solve that I would be very thankful.

Here is codesandbox link: https://codesandbox.io/s/jovial-nobel-i1lg4

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