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
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
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