reactjs / react.dev

The React documentation website
https://react.dev/
Creative Commons Attribution 4.0 International
10.86k stars 7.45k forks source link

New definition of uncontrolled components? #5486

Open Spoof14 opened 1 year ago

Spoof14 commented 1 year ago

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:

L2HYUNN commented 1 year ago

I also wondered about this part.

In my opinion, rather than just being wrong, it seems to be a new definition.

but, it cam makes some confusing about understanding controlled, uncontrolled component.