react后台管理系统—0922
①
报错:Error: Invariant failed: You should not use outside a
原因:在Router外使用NavLink标签
解决:给根组件套上BrowserRouter外标签
②
报错:Functions are not valid as a React child. This may happen if you return a Component instead of from render. Or maybe you meant to call this function rather than return it.
原因:在优化路由组件,进行懒加载时,Suspense标签的fallback属性,组件标签错给成了类
解决:Suspense fallback={Loading} => Suspense fallback={}
③
报错: TypeError: this.setState is not a function
原因:this指向丢失,this.setKey的this指向undefined
解决:this.setKey => this.setKey.bind(this)