Feature: Add native support for error boundaries in Functional Components via a new hook
未关闭
还没有人认领这个 Issue。
- 主要语言
- JavaScript
- 星标
- 11.8k
- 派生
- 7.9k
- 平均合并
- 1 天 11 小时
- 30 天内合并 PR
- 11
描述
Issue Body (Example):
💡 Problem: Currently, to implement an Error Boundary in a React application (a component that catches JavaScript errors anywhere in its child component tree, logs those errors, and displays a fallback UI), developers must use a Class Component with the componentDidCatch lifecycle method. This breaks the pattern of using hooks/functional components for the rest of the application.
🚀 Proposed Feature: Introduce a new hook, perhaps useErrorBoundary, that allows a Functional Component to act as an Error Boundary.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先查看现有的、关于基于类的错误边界和 componentDidCatch 生命周期方法的文档。将该行为与拟议的 useErrorBoundary hook 进行比较,并定义函数组件将如何捕获错误、记录错误以及渲染回退 UI。完成的标准是该功能已实现,并且其行为和示例已写入文档。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, react
- 领域
- frontend
- Issue 类型
- 功能
- 难度
- 5/5
- 预计耗时
- 一周以上
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 20/100