title: Connecting react native to nodejs back end
body: <p>Am trying to make a simple react native app that fetches the data from my express (nodejs app) and just simply show case it. 
  the app works fine with api links I used from the web but for some reason when I use my own local server ( my own nodejs app) it doesn't show anything. </p>
  
  <p>Am new to react native so I need your help.</p>
  
  <p>This the code of my App.js ( from react native ) : </p>
  
  <pre><code>import React, { Component } from "react";
  import { Platform, StyleSheet, Text, View, FlatList } from "react-native";
  export default class App extends Component&lt;Props&gt; {
    state = {
      data: [],
    };
  
    fetchData = async () =&gt; {
      const response = await fetch("http://myipadress:5001/articles");
      const articles = await response.json();
      this.setState({ data: articles });
    };
    componentDidMount() {
      this.fetchData();
    }
    render() {
      return (
        &lt;View&gt;
          &lt;Text&gt;data&lt;/Text&gt;
  
          &lt;FlatList
            data={this.state.data}
            keyExtractor={(item, index) =&gt; index.toString()}
            renderItem={({ item }) =&gt; (
              &lt;View
                style={{ backgroundColor: "#abc123", padding: 10, margin: 10 }}
              &gt;
                &lt;Text style={{ color: "#fff", fontWeight: "bold" }}&gt;
                  {item.title}
                &lt;/Text&gt;
  
                &lt;Text&gt;{item.genre}&lt;/Text&gt;
              &lt;/View&gt;
            )}
          /&gt;
        &lt;/View&gt;
      );
    }
  }
  
  const styles = StyleSheet.create({
    container: {
      flex: 1,
      justifyContent: "center",
      alignItems: "center",
      backgroundColor: "#F5FCFF",
    },
  });
  </code></pre>
  
  <p>and this is my api : that i access from the link <a href="http://myipadress:5001/articles" rel="nofollow noreferrer">http://myipadress:5001/articles</a> : </p>
  
  <pre><code>[
      {
          "featured_media": {
              "source_url": "String",
              "caption": "String",
              "media_type": "String"
          },
          "categories": [
              "String"
          ],
          "tags": [
              "String"
          ],
          "_id": "5ea02d3d12d8153e34f779ca",
          "date": "2020-04-22T11:40:45.000Z",
          "title": "String",
          "excerpt": "String",
          "author": "String",
          "link": "String",
          "published_at": "2020-04-22T11:40:45.000Z",
          "content": "String",
          "__v": 0
      }
  ]
  </code></pre>