Showing network connectivity status
In this recipe, we will learn how to use Redux to keep the state of the network status. When we lose network connectivity, we will display an alert message to inform the user there's no network available.
This recipe depends on the previous one. We are going to use the
NetInfo class to listen to network changes, then we will keep the status of the network an the store and display an alert when the device is offline.
How to do it...
- We will start by creating the action that we will trigger when the
networkstatus changes. This action will receive the current type of network the device is connected to, for example,
vpn, and so on. If the type is none, it means the device is offline. Let's ...