Reputation: 33
So I'm trying to send some objects to another screen but the problem is when I use navigation.navigate('ScreenName', {object})
I'm passing the data but also navigating to the secreen as well. I just want to pass the data without navigating to the screen itself and when needed I can go to that screen and view the data I sent.
Upvotes: 0
Views: 90
Reputation: 41
Sounds like you need a state management solution of some sort.
Without seeing what your code looks like it's hard to know what the best solution would be for you , but perhaps try keeping that object in a Context / Provider which can be shared / subscribed to by both screens.
https://reactjs.org/docs/context.html
Upvotes: 1