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

143
Vistas
In React-Native, using navigation.push, how can I keep the data from the previous screens?

What I'm trying to do is very common: I need to navigate between user profiles and being able to go back to each of them.

User1 -> User2 -> User3 And then User3 -> User2 -> User1

To do so, I'm using the navigation.push() method like this :

navigation.push('Profile', {userId: state.userId})

Each time, I call the Profile component, it fetches to relevant data using the userId passed in route.params.

The problem occurs when I want to navigate back. The previous Profile components only display the data of the last fetched user data...

Was my approach wrong ?

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

0

You need to keep some kind of global cache which every screen reads from. The data will be up to date if every screen reads from the same place.

The easiest way to do this would be to use react-query for data fetching: https://react-query.tanstack.com/

There are also other options like storing data in Redux after fetching etc.

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