title: React on click call API and create csv
body: <p>I'm working on a React app served by a RoR backend. I want to have a button that, when clicked, will query the server for the required data and create the CSV for download in the users browser.</p>
  
  <p>I'm pretty versed in the Rails side of things but I'm not at all sure how to go about doing this on the React side (or even if that's the best order to do it in as I've seen some answers saying it might be better to do the API call when the component initially mounts). </p>
  
  <p>Any advice is appreciated!</p>