Moeez Atlas
Moeez Atlas

Reputation: 116

How to refresh the parent screen and get old state values when using Goback function from child screen Reach Navigation Hooks?

i am using hooks and setting state values. I have 2 screens. When i come back from screen2 using goback() to screen1, i need to get the old state values which were hard coded.

Upvotes: 0

Views: 98

Answers (1)

Aswin C
Aswin C

Reputation: 1222

Checkout React navigation events

   React.useEffect(() => {
      const unsubscribe = navigation.addListener('focus', () => {
        // do something
      });

      return unsubscribe;
    }, [navigation]);

Upvotes: 1

Related Questions