Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Tutorial should not mention getDOMNode #8935

Closed
jaredbeck opened this issue Feb 6, 2017 · 8 comments
Closed

Docs: Tutorial should not mention getDOMNode #8935

jaredbeck opened this issue Feb 6, 2017 · 8 comments

Comments

@jaredbeck
Copy link

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

@gaearon
Copy link
Collaborator

gaearon commented Feb 6, 2017

These are not the current docs, it's just @chenglou’s old fork :-)

The docs are here: https://facebook.github.io/react/docs/tutorial.html
The tutorial itself has been rewritten with a different example, too.

Hope this helps!

@gaearon gaearon closed this as completed Feb 6, 2017
@chenglou
Copy link
Contributor

chenglou commented Feb 6, 2017

Crap, why is my page ranked so high on google?

@gaearon
Copy link
Collaborator

gaearon commented Feb 6, 2017

Must be all your thoughtleadering!

@jaredbeck
Copy link
Author

Thanks. Cheng, maybe you could take down your old pages so they don't confuse other beginners like me?

@gaearon
Copy link
Collaborator

gaearon commented Feb 6, 2017

Unfortunately this would still be an issue for any of 10K forks of React. Maybe we can add some detection code that adds a banner to the top of the doc page?

@chenglou
Copy link
Contributor

chenglou commented Feb 6, 2017

@jaredbeck through which link did you access my fork?

@jaredbeck
Copy link
Author

Maybe we can add some detection code that adds a banner to the top of the doc page?

That would be better than nothing. I'm worried that I just spent a few hours learning some outdated techniques. :(

@jaredbeck through which link did you access my fork?

I don't remember, sorry.

@chenglou
Copy link
Contributor

chenglou commented Feb 6, 2017

For whatever reason you got linked to my fork; It doesn't make sense for me to delete mine, or Dan's, or whoever else's.

I can't disable my gh-pages; but I've updated it to the latest react#gh-pages. This way if anyone stumbles upon my fork they'll at least see up-to-date info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants