reactjs / reactjs/react.dev

Add explanation on React event systems in documentation

Đang mở
#2,536 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

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ả

Recently I come across a task to embed a React app into another project. It takes a torturing amount of time to learn the lesson that React events and native events are different in significant ways. This article greatly elaborates on it: https://fortes.com/2018/react-and-dom-events/

I didn't see any related details in event-related documentations in React though. It would save a lot of time for future readers if the documentation could contain the analysis and explanation of these points:

Avoid using addEventListener and rely on React event handlers
Listen on document (or window) if you want to receive events after all React handlers. Listen anywhere else in order to receive before React handlers
React event handlers will always execute after native capture handlers

Thanks.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Xem lại tài liệu React hiện có liên quan đến sự kiện và bài viết được liên kết về React-and-DOM events. Thêm phần giải thích bao quát các handler của React so với addEventListener, thứ tự của các listener trên document hoặc window và các handler capture native; tài liệu phải giúp người đọc hiểu khi nào mỗi hệ thống sự kiện được thực thi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, react
Lĩnh vực
documentation, frontend
Loại issue
Tài liệu
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
42/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.