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

96
Visualizações
React sessionStorage vs localStorage vs Cache

I am working with React and have some data from the API that I must store/persist so that the API is not called every time the page is rendered, only the first time.

I was wondering what are the main differences between local, session and cache? What I saw was that localStorage is persisted in the browser forever until it is removed by the client, session storage is persisted until the user gets in to the new tab, but cache is an engima to me. If somebody could explain the difference between cache and the first two?

Also, I have a token that expires every 60 minutes and is checked on every API call. If it expires, the user is kicked out and must log on again to see the page. So, after 60 minutes of the user being logged in, I want to delete the persisted API data, kick the user -> user logs in again, call the API, fill the data...What is my best option? Cache, local, session, something else?

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