I am trying build a web scraping app using Reactjs. I used nightmare.js in normal JS and I did get the desired output. But when I tried adding in a button and creating functions it did not work well.
I now thought of going straight with ReactJS because that is what I want to end up doing eventually.
Can someone give a tiny example code of using nightmare.js or Casper.js inside ReactJS in the jsx format or any TIPS or Pointers. I know this may sound silly or simple, appreciate any help. I basically want it to kick in when I run node server.js. I can later add in buttons , css , etc .
I am trying build a web scraping app using Reactjs. I used nightmare.js in normal JS and I did get the desired output. But when I tried adding in a button and creating functions it did not work well.
I now thought of going straight with ReactJS because that is what I want to end up doing eventually.
Can someone give a tiny example code of using nightmare.js or Casper.js inside ReactJS in the jsx format or any TIPS or Pointers. I know this may sound silly or simple, appreciate any help. I basically want it to kick in when I run node server.js. I can later add in buttons , css , etc .
Share Improve this question asked May 18, 2017 at 23:31 JSjohnJSjohn 771 gold badge1 silver badge14 bronze badges 2- What are you trying to achieve and why would you like to use React? – Geraint Commented May 18, 2017 at 23:56
- @Geraint I am trying to make a web app to collect data from a website. like a finance website taking data when ever I click a button. After learning JS , ReactJS is what am currently learning and I wanted to get straight into project and learn on the go. They say its easier and better start before other libraries. I hope so. – JSjohn Commented May 19, 2017 at 3:47
1 Answer
Reset to default 13React tends to be used for more presentational purposes i.e. displaying the data you have scraped and not the actual scraping.
If you are going to use javascript for scraping I would suggest using your node backend to do this (assuming you are using node).
Create a route that your React app can call and let your backend code do the work. Take a look at this tutorial, it's a couple of years old but should point you in the right direction.
https://scotch.io/tutorials/scraping-the-web-with-node-js