jhen0409 / react-chrome-extension-boilerplate

Boilerplate for Chrome Extension React.js project
MIT License
2.14k stars 388 forks source link

accessing `document` in React components #48

Open brandonmp opened 8 years ago

brandonmp commented 8 years ago

I'd like to use the inject.js to scrape data from the DOM and pass it back to the background redux store.

Is that possible with the way the app is injected?

So far I have tried importing the store into inject.js and calling dispatch, but that doesn't work.

When I try to access document from within a React component, it only returns the DOM of the react component, not the page being viewed.

kokjinsam commented 7 years ago

You can use message passing to send the data to the store in your background redux store. Here's a pretty cool lib to do that.