Home > Web Front-end > JS Tutorial > body text

Use react.js to get real DOM nodes

零下一度
Release: 2017-04-17 14:45:55
Original
1437 people have browsed it

The following editor will bring you an article about getting real DOM nodes in react.js. The editor thinks it’s pretty good, so I’ll share it with you now and give it as a reference. Let’s follow the editor to take a look.

In order to obtain the real DOM node, the text input box must have a ref attribute, and then this.refs.[refName] will return the real DOM node.

var MyComponent = React.createClass({
 handleClick: function() {
  this.refs.myTextInput.focus();
 },
 render: function() {
  return (
   

); } }); ReactDOM.render( , document.getElementById('example') );
Copy after login

The above is the detailed content of Use react.js to get real DOM nodes. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!