Performance Issue : ReactDom.render vs ReactDOM.createRoot
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Tài liệu
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, react
- Lĩnh vực
- documentation
Hướng nghiên cứu
Issue không nêu tệp tài liệu, test hoặc entry point nào. Trước tiên, hãy xác định ReactDOM.render và ReactDOM.createRoot nên được ghi tài liệu ở đâu, sau đó xác nhận phạm vi dự kiến và các tiêu chí nghiệm thu trước khi thực hiện thay đổi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
The conventional technique for rendering a React component to a particular DOM element. The root of the app is
ReactDOM.render. Consider this:
ReactDOM.render(<App />, document.getElementById('root'));
In this instance, the component is being rendered to the
element on the page.createRoot : In order to render components in a new way with better performance and better support for concurrent mode, React 17 introduced a new method called createRoot. The fundamental operation of createRoot is similar to that of ReactDOM.render, except that it creates a new root container and returns a reference to it rather than rendering to a particular DOM node. Then, you can render your components to the root container using the returned reference. For instance:
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(<App />);
In conclusion, the primary distinction between createRoot and ReactDOM.render is that createRoot generates a new root container for rendering components, whereas ReactDOM.render renders components directly to a given DOM element.
- Ngôn ngữ chính
- JavaScript
- Star
- 11.8k
- Fork
- 7.9k
- Merge trung bình
- 16 giờ 6 phút
- Pull request đã merge (30 ngày)
- 7
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.
Issue khác của reactjs/react.dev
-
type: documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
-
bug: unconfirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
-
type: typos
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
-
bug: unconfirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100