[Suggestion]: Add some elaboration to the docs for TypeScript DOM events and Pure Functions
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- JavaScript
- Star
- 11.8k
- Fork
- 7.9k
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 11
Mô tả
Summary
The Section on DOM events in the page Using TypeScript, mentions extracting functions, this can be elaborated further to include the case where we do get the types i.e. inline methods.
The section on Pure Functions contain a example of Teacups and guests, the global let guests variable should be incremented by 1, but is incremented by 2. Since, React is running in StrictMode for development, this might be confusing for newbies. Found here: https://react.dev/learn/keeping-components-pure#side-effects-unintended-consequences
Edit: The deep dive for this chapter contains the explanation.
Page
https://react.dev/learn/keeping-components-pure
Details
Add another small example where it shows that we do get types when using inline methods, to make it more clear.
Either turn off Strict mode for this example OR explain why we are getting 2, 4, 6 instead of the expected 1, 2, 3 because of React.StrictMode.
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Mở trang keeping-components-pure được liên kết và phần Using TypeScript, sau đó tìm phần thảo luận về các sự kiện DOM liên quan đến việc tách các hàm. Thêm một ví dụ nhỏ về phương thức inline cho thấy các kiểu sự kiện được suy luận, đồng thời xác nhận rằng phần giải thích đủ rõ ràng cho người mới bắt đầu.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- react, typescript
- Lĩnh vực
- documentation
- Loại issue
- Tài liệu
- Độ khó
- 1/5
- Thời gian dự kiến
- Dưới một giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 50/100