title: error: attempted to update component that has already been unmounted (or failed to mount)
body: <p>I'm new to React, I'm having trouble rendering my app due to this error. It's seems the data that I'm trying to render as elements won't render due to trying to set state when unmounted? </p>
  
  <p>I'm not sure how I'm getting this error, as I'm setting the state of <code>Data</code> in <code>componentDidMount</code>.</p>
  
  <p>How can I fix this issue?  </p>
  
  <blockquote>
    <p>error: attempted to update component that has already been unmounted (or failed to mount)</p>
  </blockquote>
  
  <pre><code>class Profile extends React.PureComponent {
    static propTypes = {
      navigation: PropTypes.object,
      handleLogout: PropTypes.func,
      user: PropTypes.object,
    };
  
    static navigationOptions = {
      headerVisible: true,
      title: 'Profile',
    };
  
  constructor(props) {
      super(props);
  
      this.state = {
      data: [],
      loading: true
  
      };
    }
  
  componentDidMount() {
  
    fetch("http://10.0.2.2:8080/combined", { method: 'get' })
      .then(response =&gt; response.json())
      .then(data =&gt; {
        this.setState({data: data,});
  
      })
     .catch(function(err) {
       // 
     })
  }
  
   render() {
  
      const { user } = this.props;
      let email;
  
      if (user) {
        email = user.rows[0].ACCTNO;
      }
      return (
        &lt;ContentWrapper&gt;
          &lt;View style={styles.container}&gt;
            &lt;Image style={styles.header} source={images.profileHeader} /&gt;
            &lt;View style={styles.body}&gt;
              &lt;Avatar email={email} style={styles.avatar} /&gt;
               {
     this.state.data.map(function(rows, i){
           this.setState({mounted:  true});
  
      return(
        &lt;View key={i}&gt;
          &lt;Text&gt;{rows.FIRSTNAME}&lt;/Text&gt;
        &lt;/View&gt;
      );
    })
  }            &lt;Text style={styles.email}&gt;{_.capitalize(email)}&lt;/Text&gt;
  
              &lt;Button
                title="Log out"
                icon={{ name: 'logout-variant', type: 'material-community' }}
                onPress={this.logout}
                style={styles.logoutButton}
              /&gt;
            &lt;/View&gt;
          &lt;/View&gt;
        &lt;/ContentWrapper&gt;
      );
    }
  }
  
  export default Profile;
  </code></pre>