Skip to content

Expose refs on DOM Components as Direct Handles to the actual DOM Node #3223

@sebmarkbage

Description

@sebmarkbage

My mental model is that we have a polyfill layer (ReactDOMInput) to support what the browser would support, and will support in the future once these ideas propagate through the standards. The fact that it is currently implemented as a wrapper should be an unobservable implementation detail, and perhaps it shouldn't be implemented as a wrapper.

As an upgrade path we would need to monkey patch existing legacy methods (props, setProps, getDOMNode) onto it as an upgrade path. These would work but immediately warn when used.

setProps will be replaced by some other imperative layer, or simply multiple calls to React.render.

component.getDOMNode is being replaced by React.findDOMNode(component) which can take either an arbitrary component or a DOM node directly. So you can use it on something that you're unsure about. In most cases, you can simply get rid of the call all together and use the DOM ref directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions