Reputation: 116
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
Reputation: 1222
Checkout React navigation events
React.useEffect(() => {
const unsubscribe = navigation.addListener('focus', () => {
// do something
});
return unsubscribe;
}, [navigation]);
Upvotes: 1