title: Reading data from JSON file using react
body: <p>I am really new to using react, I am using IntelliJ as my IDE. </p>
  
  <p>I am trying to show the contents of a JSON data file on my website but I am getting errors saying that I have created an illegal import deceleration. </p>
  
  <pre><code>import PostData from "./JSONData.js";
  </code></pre>
  
  <p>My class to load the infgormation in a class is below</p>
  
  <pre><code>class Invoice extends React.Component
  {
      render()
      {
          return (
                  &lt;div className ="container"&gt;
                      &lt;h2&gt;Allstate NI Graduate Application&lt;/h2&gt;
                      &lt;h2&gt;Invoice&lt;/h2&gt;
  
                      {PostData.map((postDetail, index)=&gt;{
                      return &lt;h1&gt;{postDetail.code}&lt;/h1&gt;
                      })}
  
  
                  &lt;/div&gt;
          );
      }
  }
  </code></pre>
  
  <p>This is my main HTML</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="UTF-8"&gt;
    &lt;title&gt;Gerry Byrne and David Wilson - ReactJS Tutorials&lt;/title&gt;
    &lt;img src="../Drawable/carImage.png" id="carImg"&gt;
  
                                                &lt;!--Bootstap CSS--&gt;
    &lt;link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css"
          integrity="sha384-9gVQ4dYFwwWSjIDZnLEWnxCjeSWFphJiwGPXr1jddIhOegiu1FwO5qRGvFXOdJZ4"
          crossorigin="anonymous"&gt;
  
                            &lt;!-- Tells the file to get the react.js file from a CDN.--&gt;
    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.4.0/react.js"&gt;&lt;/script&gt;
                              &lt;!--Tells the file to get the react-dom.js file from a CDN--&gt;
    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.4.0/react-dom.js"&gt;&lt;/script&gt;
    &lt;!--The above two scripts used to be one but have since been seperated / ReactDom is only used to render ReactDOM.render()--&gt;
  
    &lt;!----&gt;
    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/JSXTransformer.js"&gt;&lt;/script&gt;
                                          &lt;!--Tells the file to get the compiler file from a CDN--&gt;
    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.24/browser.min.js"&gt;&lt;/script&gt;
    &lt;!----&gt;
    &lt;script src="https://cdnjs.cloudflare.com/ajax/libs/react-router/2.5.2/ReactRouter.min.js"&gt;&lt;/script&gt;
    &lt;link rel="stylesheet" href="../css/style.css" /&gt;
  
    &lt;!-- Latest compiled and minified CSS Bootstrap--&gt;
    &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"&gt;&lt;/link&gt;
  &lt;/head&gt;
  &lt;body&gt;
    &lt;div id="contentgoeshere"&gt;&lt;/div&gt;
    &lt;br/&gt;
  
    &lt;script type="text/jsx" src = "../JavaScript/ReactJSV3.js"&gt;&lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I am not sure what I need to add to allow my project to import these files. This is the error I am getting:</p>
  
  <p><a href="https://i.stack.imgur.com/Qapi3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Qapi3.png" alt="enter image description here"></a></p>