title: How to extract data from Axios get request?
body: <p>I have two files. One is &quot;actions.js&quot; and the other one is &quot;Profile.js&quot;. The first file has a function that calls an API that will get information about an user based on his/her id.</p>
  <p>The code for &quot;actions.js&quot; is:</p>
  <pre><code>import axios from &quot;axios&quot;;
  export const getPerson = (id, history) =&gt; async dispatch =&gt; {
    try {
      const res = await axios.get(`http://localhost:6969/users/getUsers/${id}`);
      const { email } = res.data;
      console.log(email);
      dispatch({
        type: GET_PERSON,
        payload: res.data,
  
      });
    } catch (error) {
      history.push(&quot;/profile&quot;);
    }
  };
  
  </code></pre>
  <p>The code for my &quot;Profile.js&quot; page is:</p>
  <pre><code>import React, { Component } from 'react'
  import { getPerson } from '../actions/personActions';
  import * as PropTypes from 'prop-types'
  import { connect } from &quot;react-redux&quot;;
  
  render() {
          
  
  
    
          this.props.getPerson(id, this.props.history);
  
          ----------- Followed by render method
  }
  
  Profile.propTypes = {
      getPerson: PropTypes.func.isRequired
    };
    
  const mapStateToProps = state =&gt; ({
  errors: state.errors
  });
    
  export default connect(
      mapStateToProps,
      { getPerson }
  )(Profile);
  </code></pre>
  <p>Problem is that I cannot show those responses in my Profile page by even localstorage if I decide to put the respective value in it. Tried with variety of ways but it shows up in the action.js page if I see from console using inspect log however it shows undefined in the Profile.js page. Please tell me where did I made it wrong. Thanks.</p>