'How to pass state variable data between two functions in react native expo?

I have two functions. My First.js function has two state variables that I want to send to Second.js . I have tried sending data using Stack Navigation route params but it keeps on saying "undefined is not an object route.params.firstVariable" How would I send data without using navigation?



Solution 1:[1]

If the functions/components are mounted on different screens, you will have to pass them through the navigator. If they are on the same screen, you can pass them as props.

Share the code if you still have an issue

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 shubham84