Document we should probably use React.memo under our Context Provider
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ả
It is not immediately obvious that when the component that declares the context provider re-renders, all its descendants will also render, and not just the components that subscribe to the context.
This has been made explicit by @sophiebits on Twitter: https://twitter.com/sophiebits/status/1228942768543686656, and @markerikson on his blog: https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/#context-updates-and-render-optimizations, but following the right people on twitter should not be a requirement to understand how React is supposed to be used.
While it's true that if one reasons about how React decides to render components (given one has a sufficient understanding of it) this behaviour can be inferred, I still think that an explicit recommendation would help a majority of React users.
Happy to try submitting a PR if needed :)
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
Không có tệp hoặc bài kiểm thử cụ thể nào được nêu. Hãy tìm phần hướng dẫn về React Context Provider trong tài liệu trên react.dev và xem lại các tài liệu tham khảo về việc render được liên kết; công việc được xem là hoàn tất khi tài liệu giải thích rõ việc các hậu duệ được render lại và nêu khuyến nghị dự kiến về React.memo.
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
- Lĩnh vực
- documentation
- Loại issue
- Tài liệu
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- 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