title: How to display the data from MongoDB in Reactjs?
body: <p>I am constantly getting an error of: 'Cannot read property 'map' of undefined even though in the console it says username, name, membershipActive are being assigned values but not being used. So there seems to be a mistake with my mapping. If anyone can help me out, that would be great!</p>
  
  <pre><code>import React, { Component } from 'react';
  import { getUserList } from "../services/backendCallService";
  import axios from 'axios';
  
  export default class ManageUsers extends Component {
    state = { user: {} };
    async componentDidMount() {
      const { data: user } = await getUserList();
      this.setState({ user });
    }
  
    getUsersList() {
      return this.state.userInfo.map(user =&gt; {
        const {username, name, membershipActive} = user;
      })
    }
  
    render() {
      return (
        &lt;div&gt;
          &lt;h3&gt;Manage Users&lt;/h3&gt;
          &lt;table className="table"&gt;
            &lt;thead className="thead-light"&gt;
              &lt;tr&gt;
                &lt;th&gt;Username&lt;/th&gt;
                &lt;th&gt;Name&lt;/th&gt;
                &lt;th&gt;Membership Active&lt;/th&gt;
              &lt;/tr&gt;
            &lt;/thead&gt;
            &lt;tbody&gt;
              {this.getUsersList()}
            &lt;/tbody&gt;
          &lt;/table&gt;
        &lt;/div&gt;
      )
    }
  }
  
  </code></pre>