title: How to connect to SQL database with react?
body: <p>I currently have a website, written in HTML and PHP, that can access my SQL database. I have now started learning React and want my super simple website to also connect to an SQL database. </p>
  
  <p>Previously i've done this: </p>
  
  <pre><code>&lt;php
      $conn = mysqli_connect($serverIP, $dbusername,$dbpassword,$dbname);
      if(mysqli_errno($conn)) {
       die("&lt;p&gt;MySQL error:&lt;/p&gt;\n&lt;p&gt;" . mysqli_error($conn) . "&lt;/p&gt;\n&lt;/body&gt;\n&lt;/html&gt;\n");
      }
  ?&gt;
  </code></pre>
  
  <p>and then in the index.php file, done this: </p>
  
  <pre><code>&lt;?php include_once "connection.php"; ?&gt;
  </code></pre>
  
  <p>And continued with basic SQL to fetch data. </p>
  
  <p>How do I do the same in React? More specifically, how do I write PHP in React to be able to connect to an SQL database? How does this code look like? </p>
  
  <p>Also, as I am learning React on my own it would be great if there was a place where people could review code, and where I could receive tips on improvement. Is there such a website/community?</p>