title: React Native fetch data from Express.js server
body: <p>EDIT: This was fixed by switching to a different Android phone emulator</p>
  
  <p>I'm trying to create a simple React Native app that first off would fetch a json file from Express backend.</p>
  
  <p>Backend:</p>
  
  <pre><code>...data to be fetched up here in a dictionary
  
  //Enable CORS
  app.use((req, res, next) =&gt; {
    res.header("Access-Control-Allow-Origin", "*");
    res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
    next();
  });
  
  app.use(bodyParser.json());
  
  app.get('/sightings', (req, res) =&gt; {
    res.json(sightings);
  });
  
  app.post('/sightings', (req, res) =&gt; {
    req.body.id = (sightings.length + 1).toString();
    sightings.push(req.body);
    res.json(req.body);
  });
  
  app.get('/species', (req, res) =&gt; {
    res.json(species);
  });
  
  const port = process.env.PORT ? process.env.PORT : 8081;
  const server = app.listen(port, () =&gt; {
      console.log("Server listening  port %s", port);
  });
  </code></pre>
  
  <p>Frontend:</p>
  
  <pre><code>export default class Menu extends React.Component {
  
      constructor(props) {
          super(props);
  
          this.state = {
              key: '',
              sightings: [],
          }
      }
  
      componentDidMount() {
          fetch('http://10.0.0.2:3000/sightings')
              .then(res =&gt; res.json())
              .then(res =&gt; {
                  this.setState({sightings: res })
              })
              .catch((error) =&gt; {
                  console.log(error);
              });
          console.log(this.state.sightings);
      }
  </code></pre>
  
  <p>Obviously the point here is to update sightings in state with the data, but it's not working, I'm only returned the empty object assigned to this.state.sightings originally. </p>
  
  <p>Is there some step I'm missing? I'm very much a beginner with using a node server and the various tutorials I followed did it just like this.</p>
  
  <p><a href="https://i.stack.imgur.com/TFgWJ.png" rel="nofollow noreferrer">data on local host</a></p>