I would like to check my Internet connection in my Ionic React application. All what I find on Internet is for Ionic angular. How can I do that ?
CodePudding user response:
If you are using Ionic with Capacitor u can use the @capacitor/network api.
CodePudding user response:
Ok thanks, I find something else ...
['load', 'online', 'offline'].forEach(function (e) {
window.addEventListener(e, () => { props.setNetworkState(navigator.onLine ? "online" : "offline") });
});