title: Wait for AJAX request ( React, Redux)
body: <p>Need display data after AJAX call will be done.</p>
  
  <p>My Reducer:</p>
  
  <pre><code>import { INCOME_PROFILE } from '../actionTypes'
  import Immutable from 'immutable'
  
  const initialUserState = [];
  const profileReducer = function(state = initialUserState, action) {
     //console.log('actiondata in reducer:' + action.data + action.type);
  
    switch(action.type) {
  
      case 'INCOME_PROFILE_IS_LOADING': 
       return Object.assign({}, state, {  hh: action.hasFetched });
  
    case 'INCOME_PROFILE': 
           return Object.assign({}, state, { course_list: action.data, hh: action.hasFetched });
  
    default: 
  
    return state;
    }
  }
  export default profileReducer
  </code></pre>
  
  <p>My action creator:</p>
  
  <pre><code>export function GET_ITEM_REQUEST() {
    return {
      type: INCOME_PROFILE_IS_LOADING,
      hasFetched: false,
    }
  }
  
  
  
  function receiveData(json) {
      return{
  
          type: INCOME_PROFILE,
          data: json,
          hasFetched: true
      }
  };
  
  export function IncomeProfileList () {
  
      return dispatch =&gt; {
  
          return (
  
              axios.post(Api.getURI("profile"),{}, {
        headers: { 'X-Authenticated-Userid': '15000500000@1' }
       }).then(function (response) {
  
  
                  //console.log(response.data);
                  dispatch(receiveData(response.data.body));
  
              })
          .catch((error) =&gt; {
                  console.log(error);
              })
              )
      }
  }
  </code></pre>
  
  <p>My component:</p>
  
  <pre><code>class IncomeProfile extends Component {
    constructor(props) {
      super(props)
    }
  
    componentDidMount() {
      this.props.IncomeListProfile();
        }
  
  render() {
  console.log(this.props.isloading);
  
  if (this.props.isloading) {
              return &lt;p&gt;Sorry! There was an error loading the items&lt;/p&gt;;
          }
  }
  }
  const mapDispatchToProps = function(dispatch) {
    return {
        IncomeListProfile: () =&gt; dispatch(IncomeProfileList())
        }
    }
  
  const mapStateToProps = function(state) {
    //var mystore = state.toJS()
    var mystore = state.getIn(['incomeProfileList'])['course_list'];
    var mystored = state.getIn(['incomeProfileList']);
    console.log(mystored.hh);
    var copy = Object.assign({}, mystore);
    return {
      items: copy.course_list,
      isloading: mystored.hh
          };
  
  }
  </code></pre>
  
  <p>I need next: While response not finish, I no need to display data. Condition if not works now</p>
  
  <p>console.log at first time get undefined - think must be false, but it not state false. and second time it's getting true.</p>