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

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