O'Reilly logo

React Native Cookbook by Crysfel Villa, Stan Bershadskiy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Reacting to changes in application state

The average mobile device user has several applications that they use on a consistent basis. These can be their favorite social media platform, their second favorite, a game, a media player, and hopefully your React Native app. This user may spend a short time in each application because he or she is constantly jumping across applications. What if we wanted to react to when the user leaves our app and re-enters? Maybe we need to sync data with the server or just tell the user that we're happy to see him/her use the app again and please rate us on the app store.

This recipe will show how we can react to changes in application state, that is, when the app is in the background, inactive, or active (foreground). ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required