Hariharan Subramanian
Hariharan Subramanian

Reputation: 1531

How can I access the __reactEventHandlers property of the DOM object?

I am trying to access the '__reactEventHandlers' properties in JS. But I am not able to access the attribute in JS.But in developer console I can able see the attribute and i can able to access as well. Kindly help me on this.

enter image description here

Upvotes: 1

Views: 3018

Answers (1)

Hariharan Subramanian
Hariharan Subramanian

Reputation: 1531

Using the below mentioned way we can able to access the _reactEventHandler object form the DOM Object.

var abc=document.querySelector('._2LpG3');
var reactHandlerKey=Object.keys(abc).filter(function(item){
   return item.indexOf('__reactEventHandlers')>=0
});
var reactHandler=abc[reactHandlerKey[0]];
console.log(reactHandler) // React Event handler object and Properties

Thanks,

Hariharan S

Upvotes: 2

Related Questions