0

So I am trying to inject some javascript into a website to scrape some information. However, if I could get a reference to the react component my life would be made a lot easier. I have looked at several questions on Stackoverflow but nothing useful turned up:

Reactjs - Get a component from anywhere in the app

React - get React component from a child DOM element?

I realize that react is basically just rendering the DOM by using its internal state and so reversing the DOM is not an option. Moreover, since the javascript on the website isn't mine I can't exactly have a global reference to the React component when its created. What I would really like is to have the '$r' that the react chrome devtools provides when you choose a DOM element but without having to rely on the chrome extension. I guess my question really boils down to how can I get the same representation that the chrome dev tools does so that I can reference a react component without actually creating a global variable. Also note I don't really care about efficiency or best practices I just want the reference to the component the same way that the devtools does it.

Community
  • 1
  • 1
Manav Gabhawala
  • 997
  • 9
  • 10
  • not entirely understand your question but from what I understand you are trying to access the parent component from child component? – Ryan Huynh. Sep 23 '15 at 01:16
  • No I just want to reconstruct the React-style DOM that is shown in the chrome dev tools on a website using injected Javascript. This could then allow me to find the props and other things on the react components that I need for my scraping – Manav Gabhawala Sep 23 '15 at 04:45

0 Answers0