reactjs / reactjs/react.dev

New definition of uncontrolled components?

Đang mở
#5,486 1 bình luận 2 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ả

I was reading the new documentation for useRef, saw an overcomplicated example, made a PR where I wanted to reference the new docs for uncontrolled components, but for some reason the definition has completely changed from the original docs.

In my opinion, the new definition is wrong. An uncontrolled component is a component where the value is not stored by react at all, but rather stored natively in the DOM element.

The new docs state

It is common to call a component with some local state “uncontrolled”. For example, the original Panel component with an isActive state variable is uncontrolled because its parent cannot influence whether the panel is active or not.

The definiton from old docs:

In a controlled component, form data is handled by a React component. The alternative is uncontrolled components, where form data is handled by the DOM itself.

new docs

Old docs:

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

So sánh các định nghĩa trong tài liệu useRef, trang “Sharing State Between Components”, bài đăng blog năm 2018 về derived-state và tài liệu cũ về uncontrolled-components. Xác định xem có nên thống nhất thuật ngữ hay không, sau đó cập nhật tài liệu bị ảnh hưởng và các tham chiếu của tài liệu đó để định nghĩa và các ví dụ nhất quán.

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
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.