kangduu / front-end-camps

Front-end learning, interviews, question banks, algorithm camps.
https://kangduu.github.io/front-end-camps
MIT License
2 stars 0 forks source link

Q:Error Boundary 错误边界 #19

Open kangduu opened 1 year ago

kangduu commented 1 year ago

默认情况下,如果我们的应用程序在渲染过程中抛出错误,React 将从屏幕上删除其 UI。

为了防止这种情况,我们可以使用【错误边界】 将 UI 保留。

https://react.docschina.org/reference/react/Component#catching-rendering-errors-with-an-error-boundary