Home > Enterprise >  React native [ Passing data from one screen to another and to another screen again ]
React native [ Passing data from one screen to another and to another screen again ]

Time:10-16

I'm a noob in react native but I learn it anyways, My question is that when routing data using flatlist from one screen to another, I was able to do that using route.param. But can I send the data from screen one to screen two to screen two to screen three???

if it is possible, can you give me some references on what method should I use?? Thanks in advanced!!!

CodePudding user response:

you shoudl check about the navigation :

onPress={() => {
    navigation.navigate('MyScreen', {
        myData: data,
    });
}}

don't forget const MyCurrentScreen = ({navigation}) => {

and then in the 'MyScreen' where you navigate, you will have access to

const MyScreen = ({route}) => {
  const data = route.params.myData;

CodePudding user response:

The more better approach would be using redux or context hooks

  • Related