React16下报错引发整个页面crash的解决方法

如果报错没有没有被catch,将会引起整个React组件树的unmounting

解决方法:在生命周期中增加componentDidCatch

https://reactjs.org/blog/2017/07/26/error-handling-in-react-16.html

猜你喜欢

转载自www.cnblogs.com/fanyegong/p/9056389.html