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.

Answer

Checkout React navigation events

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

      return unsubscribe;
    }, [navigation]);