Skip to content
Advertisement

Sending states between screens react native

Am currently working with an app that will provide you with a class/race/background story from an fantasy api. I used expo’s tab template when i created the project.

So my question is how would I send data that i fetched in my Race screen to my background-story screen in order to fetch the correct background-story? I’ve been trying to googling it but couldnt find an answer that helped, the only thing i found is that its something to do with the navigator, hence why i link it.

Maintabnavigator.js

JavaScript

Advertisement

Answer

When you navigate from one screen to another as follows:

JavaScript

You may access ‘item’ in the other screen as follows:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement