[Typo]: Client Components running on the server
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 "use client" docs state:
During render, the framework will server-render the root component and continue through the render tree, opting-out of evaluating any code imported from client-marked code.
The server-rendered portion of the render tree is then sent to the client. The client, with its client code downloaded, then completes rendering the rest of the tree.
This implies that Client Components are skipped during SSR, but I don’t think that’s true.
Page
https://react.dev/reference/rsc/use-client
Details
My understanding is that Client Components will render on the server during SSR, and hydrate on the client. This is necessary so that the server-generated HTML is complete; if Client Components were truly skipped during SSR, our HTML would be full of holes that would only be filled in after hydration.
Another way to verify this is to add a console.log() to a Client Component, within a component function. The log will be printed in our server terminal, showing that the code is indeed evaluated on the server.
It’s possible I'm misunderstanding what is meant by "render" in this context, but it really makes it sound like the server skips any files that are marked with "use client". And unless this changed very recently, it is demonstrably untrue.
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
Đọc trang tham chiếu “use client” và các đoạn trích dẫn về việc render phía máy chủ cũng như cây render. Xác minh hành vi được mô tả bằng cách sử dụng ngữ cảnh của tài liệu được liên kết và đầu ra console phía máy chủ được báo cáo. Được xem là hoàn tất khi chỉnh sửa cách diễn đạt để giải thích chính xác Client Components trong quá trình SSR mà không ngụ ý rằng mã được đánh dấu là client hoàn toàn bị bỏ qua.
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
- 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