reactjs / reactjs/react.dev

Document Controlled vs Uncontrolled Component Design pattern

Đang mở
#918 14 bình luận 7 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ả

pursuant to this discussion https://twitter.com/dan_abramov/status/1001943857096003584

all react components can be:

  • controlled (no internal state)
  • uncontrolled (internal state)
  • mixed (uncontrolled by default, unless some props are passed to make it controlled)

the current docs on controlled vs uncontrolled: https://reactjs.org/docs/uncontrolled-components.html focus entirely on forms, but this design pattern applies to -all- components. we should document this.

questions

  1. What else should we say in the docs?
  2. do we want to tell people that they can do "mixed control" or do we leave that for people to discover for themselves?
  3. is this the same page as https://reactjs.org/docs/uncontrolled-components.html or is it a separate page?

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

Bắt đầu với tài liệu uncontrolled-components.html hiện có và cuộc thảo luận được liên kết. Xác định liệu controlled, uncontrolled và mixed component patterns nên thuộc về trang này hay một trang riêng, đồng thời xác định hướng dẫn mà tài liệu cần cung cấp. Công việc được xem là hoàn tất khi tài liệu được chọn bao quát rõ pattern vượt ra ngoài biểu mẫu và trả lời các câu hỏi còn bỏ ngỏ về phạm vi.

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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
35/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.