[Typo]: "A stopwatch" example for useRef does not cleanup correctly
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 55/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 停滯
- 技術堆疊
- javascript, react
研究方向
開啟連結範例中的 useRef 參考頁面,檢查「A stopwatch」程式碼,從 handleStart() 中建立並在 handleStop() 中停止的 interval 開始。確保範例也處理啟動後的卸載,然後確認文件中的範例在元件被移除時不再讓 interval 保持作用中。
由索引模型根據 Issue 內容生成。
描述
Summary
In "A stopwatch" example for useRef an interval is set in handleStart(). It is cleared in handleStop(). But if the component is unmounted after the interval is started, but without stopping it, it is never cleared, which means setNow can get called on an unmounted component.
Page
https://react.dev/reference/react/useRef#examples-value
Details
No response
- 主要語言
- JavaScript
- 星號
- 11.8k
- 分支
- 7.9k
- 平均合併
- 16 小時 6 分鐘
- 30 天內合併 PR
- 7
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
reactjs/react.dev 的其他 Issue
-
type: documentation
難度 2/5 1-3 小時 新手友好度 72/100
-
難度 1/5 1 小時以內 新手友好度 82/100
-
bug: unconfirmed
難度 2/5 1-3 小時 新手友好度 74/100
-
type: typos
難度 1/5 1 小時以內 新手友好度 90/100
-
bug: unconfirmed
難度 2/5 1-3 小時 新手友好度 68/100
查看 reactjs/react.dev 的全部 Issue
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 76/100
avniproject/avni-client#2135 ·
-
enhancement
難度 2/5 1-3 小時 新手友好度 70/100
babalae/bettergi-scripts-list#3674 ·
-
A-Release-Notes C-Editing D-Modest S-Ready-For-Implementation
難度 2/5 1-3 小時 新手友好度 72/100
bevyengine/bevy-website#2595 ·
-
ecosystem wording
難度 1/5 1 小時以內 新手友好度 90/100
matrix-org/matrix.org#3649 ·
-
難度 2/5 1-3 小時 新手友好度 88/100
vadimdemedes/ink#1029 ·