Skip to content

Docs: Tutorial should not mention getDOMNode #8935

@jaredbeck

Description

@jaredbeck

The current live docs at https://chenglou.github.io/react/docs/tutorial.html contain the following incorrect example:

// tutorial16.js
this.refs.author.getDOMNode().value.trim();

According to https://facebook.github.io/react/blog/2015/10/07/react-v0.14.html,

The other big change we’re making in this release is exposing refs to DOM components as the DOM node itself. That means: we looked at what you can do with a ref to a React DOM component and realized that the only useful thing you can do with it is call this.refs.giraffe.getDOMNode() to get the underlying DOM node. Starting with this release, this.refs.giraffe is the actual DOM node.

so, perhaps the example should be changed to

// tutorial16.js
this.refs.author.value.trim();

I tried to click on the "Edit on GitHub" link at the top of the tutorial, but got a 404. So, the only thing I could think to do was to open an issue. Hope it helps.

Thanks. ❤️

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