title: TypeError: reviews.reviewList.data is undefined in reactjs even when data is there
body: <p>I am getting the response from backed which looks something like this.
  <a href="https://i.stack.imgur.com/jpyig.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jpyig.png" alt="imagedt"></a></p>
  
  <p>But when i try to log the data like this.</p>
  
  <pre><code>render() {
      const { reviews } = this.props;
      console.log('rev', reviews.reviewList.data._embedded);
  </code></pre>
  
  <p>It gives me error saying this.</p>
  
  <blockquote>
    <p>TypeError: reviews.reviewList.data is undefined</p>
    
    <p>reviewDataReducer.jsx</p>
  </blockquote>
  
  <pre><code>const initialstate = {
    isFetching: false,
    reviewList: [],
    page: null,
    fetched: false,
    error: null
  };
  
  export default (state = initialstate, action) =&gt; {
    switch (action.type) {
      case actionTypes.GET_PRODUCT_REVIEWS_LOAD:
        return {
          ...state,
          isFetching: true
        };
      case actionTypes.GET_PRODUCT_REVIEWS_SUCCESS:
        return {
          ...state,
          fetched: true,
          reviewList: action.payload
        };
  
      case actionTypes.GET_PRODUCT_REVIEWS_ERROR:
        return {
          ...state,
          fetched: false,
          isFetching: false,
          error: action.error
        };
  
      default:
        return state;
    }
  };
  </code></pre>
  
  <blockquote>
    <p>reviewActions.jsx</p>
  </blockquote>
  
  <pre><code>export const getProductReviews = pid =&gt; dispatch =&gt; {
      console.log('rev pid',pid)
    dispatch({
      type: types.GET_PRODUCT_REVIEWS_LOAD
    });
    new _rest()
      .get(`/buyer/product/${pid}/review`)
      .then(res =&gt; {
        console.log("Review Action Response", res);
        dispatch({
          type: types.GET_PRODUCT_REVIEWS_SUCCESS,
          payload: res
        });
      })
      .catch(error =&gt; {
        dispatch({
          type: types.GET_PRODUCT_REVIEWS_ERROR,
          error: error
        });
      });
  };
  </code></pre>
  
  <blockquote>
    <p>connect</p>
  </blockquote>
  
  <pre><code>const mapStateToprops = state =&gt; ({
    reviews: state.reviews.data
  });
  
  const mapStateToDispatch = {
    getProductReviews
  };
  
  export default connect(
    mapStateToprops,
    mapStateToDispatch
  )(ReviewContainer);
  </code></pre>