react项目中页面跳转、刷新及获取网络状态

// 页面跳转
window.location.href = 'http://speedtest.wangxiaotong.com/'

// 页面刷新
window.location.reload()

// 获取当前网络状态,只能判断用户电脑有没有断网(包括无线和有线),有网为true,没有网为false
navigator.onLine