/ Published in: JavaScript

Within a react component. How to gain access to the HTML that was just rendered.
Any returned html element that is tagged with a ref, can easily be accessed by it's ref after it's been rendered. In the below case, use this.refs["domainModal"] to access the html. This access is limited to within the scope of the instance of this react component.
Any returned html element that is tagged with a ref, can easily be accessed by it's ref after it's been rendered. In the below case, use this.refs["domainModal"] to access the html. This access is limited to within the scope of the instance of this react component.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
accessDiv: function(){ var test = this.refs["domainModal"] } render: function(){ return <div ref="domainModal"></div> }
Comments
