https://medium.com/@asierr/how-to-check-network-status-in-react-without-using-external-libraries-cdfe7cb5bc73