I'm studying how react currently works and am a bit confused how to access the functions that are hidden in the props with native javascript. I'm aware if I download the react extension I can view them in the google developer console but this is not what I need. I don't have access to the react components directly because I'm making a Google chrome extension.
For example in the Chrome Developer Console, I can type the following:
var elem = document.querySelector('.wrap-XdW9S1Ib');
Lets just say that this element is my element of interest and it has an onClick event within it's props that I would like to access to automate clicks for testing purposes.
Attached is a picture of the progress so far:
I can then type something like...
elem.__reactProps$63clhtkk874
Which shows the below:
Note you can see the onClick event and other functions that react creates.
Now... if you try to do this same thing via code. In particular the for(key in elem){console.log(key);}
for some reason __reactFiber and __reactProps do not appear!
Note: Notice that align,title,lang etc... all show up but the __reactProps are not there now.
Note#2: My code is identical to what you see above in the pictures and works just fine printing out to console (as you can also see in the screenshot), except..., I just don't see the react events.
Why do these show up in the developer console and NOT in the same console via my code I write. In otherwords, when I type in the console prompt it not via non prompt (I.E, just regular .js file)