title: Accessing JSON from public folder in ReactApp
body: <p>I have a a JSON file which I would like to use its content into my React App.</p>
  
  <p>This is an excerpt from my code</p>
  
  <pre><code>export default class App extends Component{
  constructor(props){
      super(props);
      this.state = {
          entry : []
      }
  }
  
  componentDidMount(){
      fetch(process.env.PUBLIC_URL + `./js/data.json`)
      .then(res =&gt; res.json())
       .then(json =&gt; this.setState({ entry: json }));
  }
  
  render(){
      return(
          &lt;div&gt;
              &lt;ul&gt;
                  {this.state.entry.map( x =&gt; (
                      &lt;li&gt;
                          &lt;div className='centering'&gt;
                              &lt;span&gt;
                                  &lt;img alt='' key={x.img} src={process.env.PUBLIC_URL + `./img/${x.img}.jpg`}/&gt;
                              &lt;/span&gt;
                              &lt;span className='txt'&gt;
                                  { x.date }
                              &lt;/span&gt;
                              &lt;span&gt;
                                  &lt;p&gt;{ x.ctx }&lt;/p&gt;
                              &lt;/span&gt;
                          &lt;/div&gt;
                          &lt;div className='hr-line'&gt;&lt;/div&gt;
                      &lt;/li&gt;
                  ))}
              &lt;/ul&gt;
          &lt;/div&gt;
      )
  }
  </code></pre>
  
  <p>}</p>
  
  <p>this is the content of my data.json</p>
  
  <pre><code>{
  "entry" : {
      "2" : [
          {
              "date":"1/1/1",
              "img":"profile",
              "ctx":"as"
          }
  
      ],
      "1" : [
          {
              "date":"1/1/1",
              "img":"profile",
              "ctx":"as"
          }
  
      ]
  }
  </code></pre>
  
  <p>When I save the file, on the browser it shows <code>TypeError: this.state is null</code>
  on<code>render</code> <code>{this.state.entry.map (x =&gt; ...</code></p>
  
  <p>Is there something missing, or it is impossible to do so?</p>
  
  <p>Thank you in advance.</p>