title: Use React Components to generate a pdf on Server Side
body: <p>I have an application on React that shows some information based on a json stored in my Server. So when the user opens my website it gets the JSON and renders it. I want to implement a new function that enables the user also to download a PDF (related to that specific JSON). And my idea is when the JSON is available on my server I generate the PDF (completely server side) and store it. When someone goes on the front and pushes the button to Download the PDF, it goes on my storage and downloads the PDF. If I can generate the pdf based on React Components it would be much easier (because they are already implemented on the React Application).</p>
  
  <p>I am newbie to node but little experienced with React and don't know if it is possible to solve the problem like this but basically my idea was providing React a JSON, then it will generate the MainComponent based on it, then I get the html of this Component and finally generate the PDF to store on the server. On pseudo code:</p>
  
  <pre><code>const fs = require('fs');
  let required_data = JSON.parse(fs.readFileSync('myJson.json'));
  
  html = renderToStaticMarkup(&lt;MainComponent initialJson={required_data})
  </code></pre>
  
  <p>And then with this html I create the pdf with some library like html-pdf, jspdf etc.. and save it to the server. Is it possible somehow to use this approach to solve my problem?</p>