Detect and handle slow internet connection in React-Native

13,260

Solution 1

You can use https://github.com/rgommezz/react-native-offline or you can simply add timeout in axios...if request is aborted after particular time say 10 sec...re-hit the same API request and set the count limit if count limit exceeds...You can show the slow internet message.

Solution 2

I use the react-native-offline lib.

Among other things, withNetworkConnectivity() that frequently ping an url, offline queues to never miss an action...

https://github.com/rgommezz/react-native-offline

Share:
13,260
yogeshwar nair
Author by

yogeshwar nair

Everything that javascripts...

Updated on June 09, 2022

Comments

  • yogeshwar nair
    yogeshwar nair almost 2 years

    Currently I am using NetInfo of react-native and with the help of EffectiveConnectionType, I am able to find the connection is in : 2g, 3g, 4g and unknown. But is there any optimise way to handle this problem ?